def get_standardized_timestamp(timestamp, ts_format):
if not timestamp:<EOL><INDENT>return None<EOL><DEDENT>if timestamp == '<STR_LIT>':<EOL><INDENT>timestamp = str(datetime.datetime.now())<EOL><DEDENT>if not ts_format:<EOL><INDENT>ts_format = detect_timestamp_format(timestamp)<EOL><DEDENT>try:<EOL><INDENT>if ts_format == '<STR_LIT>':<EOL><INDENT>logger.error('<STR_LIT>', timestamp)<EOL>return -<NUM_LIT:1><EOL><DEDENT>elif ts_format == '<STR_LIT>':<EOL><INDENT>ts = int(timestamp) * <NUM_LIT:1000><EOL><DEDENT>elif ts_format == '<STR_LIT>':<EOL><INDENT>ts = timestamp<EOL><DEDENT>elif ts_format == '<STR_LIT>':<EOL><INDENT>ts = int(timestamp[:<NUM_LIT:10>]) * <NUM_LIT:1000> + int(timestamp[<NUM_LIT:11>:])<EOL><DEDENT>elif ts_format in ('<STR_LIT>', '<STR_LIT>'):<EOL><INDENT>date_today = str(datetime.date.today())<EOL>dt_obj = datetime.datetime.strptime(date_today + '<STR_LIT:U+0020>' + timestamp, '<STR_LIT>' + ts_format)<EOL>ts = calendar.timegm(dt_obj.utctimetuple()) * <NUM_LIT:1000> + dt_obj.microsecond / <NUM_LIT:1000><EOL><DEDENT>else:<EOL><INDENT>dt_obj = datetime.datetime.strptime(timestamp, ts_format)<EOL>ts = calendar.timegm(dt_obj.utctimetuple()) * <NUM_LIT:1000> + dt_obj.microsecond / <NUM_LIT:1000><EOL><DEDENT><DEDENT>except ValueError:<EOL><INDENT>return -<NUM_LIT:1><EOL><DEDENT>return str(ts)<EOL>
Given a timestamp string, return a time stamp in the epoch ms format. If no date is present in
timestamp then today's date will be added as a prefix before conversion to epoch ms