@staticmethod<EOL><INDENT>def utc_to_local(time_str, use_12_hour_format, show_datetime=False):<DEDENT>
if not (time_str.endswith("<STR_LIT>") or time_str.endswith("<STR_LIT>")):<EOL><INDENT>return time_str<EOL><DEDENT>today_utc = datetime.datetime.utcnow()<EOL>utc_local_diff = today_utc - datetime.datetime.now()<EOL>if time_str.endswith("<STR_LIT>"):<EOL><INDENT>time_str, _ = time_str.split("<STR_LIT>")<EOL>utc_time = datetime.datetime.strptime(time_str, '<STR_LIT>')<EOL>utc_datetime = datetime.datetime(today_utc.year,<EOL>today_utc.month,<EOL>today_utc.day,<EOL>utc_time.hour,<EOL>utc_time.minute)<EOL><DEDENT>else:<EOL><INDENT>utc_datetime = datetime.datetime.strptime(time_str,<EOL>'<STR_LIT>')<EOL><DEDENT>local_time = utc_datetime - utc_local_diff<EOL>if use_12_hour_format:<EOL><INDENT>date_format = '<STR_LIT>' if not show_datetime else '<STR_LIT>'<EOL><DEDENT>else:<EOL><INDENT>date_format = '<STR_LIT>' if not show_datetime else '<STR_LIT>'<EOL><DEDENT>return datetime.datetime.strftime(local_time, date_format)<EOL>
Converts the API UTC time string to the local user time.