@staticmethod<EOL><INDENT>def normalize_date(date):<DEDENT>
if isinstance(date, datetime):<EOL><INDENT>pass<EOL><DEDENT>elif date == "<STR_LIT>":<EOL><INDENT>date = datetime.now(pytz.UTC)<EOL><DEDENT>elif isinstance(date, (basestring, int, float, long)):<EOL><INDENT>try:<EOL><INDENT>ts = float(date)<EOL>if ts > MAX_TS_SECONDS:<EOL><INDENT>ts = ts / <NUM_LIT><EOL><DEDENT>date = datetime.utcfromtimestamp(float(ts))<EOL><DEDENT>except ValueError:<EOL><INDENT>try:<EOL><INDENT>date = dateparse(date)<EOL><DEDENT>except ValueError as e:<EOL><INDENT>raise InvalidDatalakeMetadata(str(e))<EOL><DEDENT><DEDENT><DEDENT>else:<EOL><INDENT>msg = '<STR_LIT>'.format(date)<EOL>raise InvalidDatalakeMetadata(msg)<EOL><DEDENT>return Metadata._from_datetime(date)<EOL>
normalize the specified date to milliseconds since the epoch

        If it is a string, it is assumed to be some sort of datetime such as
        "2015-12-27" or "2015-12-27T11:01:20.954". If date is a naive datetime,
        it is assumed to be UTC.

        If numeric arguments are beyond 5138-11-16 (100,000,000,000 seconds
        after epoch), they are interpreted as milliseconds since the epoch.