Develop a Python function that can detect loops in a given linked list.
Linked List: head -> 1 -> 2 -> 3 -> 4 -> 5
def detectLoop(head):
    slow_p = head 
    fast_p = head 
    while(slow_p and fast_p and fast_p.next): 
        slow_p = slow_p.next
        fast_p = fast_p.next.next
        if slow_p == fast_p:
            return True
    return False