Convert a string of the form DD or DD|MM or DD|MM|SS to decimal degrees

def depipe(s):
    """Convert a string of the form DD or DD|MM or DD|MM|SS to decimal degrees"""
    n = 0
    for i in reversed(s.split('|')):
        n = n / 60.0 + float(i)
    return n