def datetimeobj(value, fmt=None):
if fmt:<EOL><INDENT>return _datetimeobj_formats.get(fmt,<EOL>lambda v: datetimeobj_fmt(v, fmt)<EOL>)(value)<EOL><DEDENT>l = len(value)<EOL>if <NUM_LIT> <= l <= <NUM_LIT> and value[<NUM_LIT:3>] == "<STR_LIT:U+0020>":<EOL><INDENT>try:<EOL><INDENT>return datetimeobj_d_b_Y_H_M_S(value)<EOL><DEDENT>except (KeyError, ValueError):<EOL><INDENT>pass<EOL><DEDENT><DEDENT>if <NUM_LIT:30> <= l <= <NUM_LIT>:<EOL><INDENT>try:<EOL><INDENT>return datetimeobj_a__d_b_Y_H_M_S_z(value)<EOL><DEDENT>except (KeyError, ValueError):<EOL><INDENT>pass<EOL><DEDENT><DEDENT>if l == <NUM_LIT>:<EOL><INDENT>try:<EOL><INDENT>return datetimeobj_YmdHMS(value)<EOL><DEDENT>except ValueError:<EOL><INDENT>pass<EOL><DEDENT><DEDENT>try:<EOL><INDENT>return datetimeobj_epoch(value)<EOL><DEDENT>except ValueError:<EOL><INDENT>pass<EOL><DEDENT>return datetimeobj_any(value)<EOL>
Parse a datetime to a datetime object.

    Uses fast custom parsing for common datetime formats or the slow dateutil
    parser for other formats. This is a trade off between ease of use and speed
    and is very useful for fast parsing of timestamp strings whose format may
    standard but varied or unknown prior to parsing.

    Common formats include:
        1 Feb 2010 12:00:00 GMT
        Mon, 1 Feb 2010 22:00:00 +1000
        20100201120000
        1383470155 (seconds since epoch)

    See the other datetimeobj_*() functions for more details.

    Args:
        value: A string representing a datetime.

    Returns:
        A datetime object.