def parse_now_field(s):
    """Return a datetime instance from a string generated by now_field.
    IMPORTANT: the datetime will be in UTC"""
    if not s.startswith('UTC:'):
        return None  # Invalid string
    s = s[4:]

    # isoformat can return strings both with and without microseconds - we
    # account for both
    try:
        dt = datetime.datetime.strptime(s, '%Y-%m-%dT%H:%M:%S.%f')
    except ValueError:
        dt = datetime.datetime.strptime(s, '%Y-%m-%dT%H:%M:%S')

    return dt
def parse_now_field ( s ) : if not s . startswith ( 'UTC:' ) : return None s = s [ 4 : ] try : dt = datetime . datetime . strptime ( s , '%Y-%m-%dT%H:%M:%S.%f' ) except ValueError : dt = datetime . datetime . strptime ( s , '%Y-%m-%dT%H:%M:%S' ) return dt
Return a datetime instance from a string generated by now_field.
    IMPORTANT: the datetime will be in UTC