code: def utc_to_local(time_str, use_12_hour_format, show_datetime=False):
          
          if not (time_str.endswith(" UTC") or time_str.endswith("Z")):
              return time_str
  
          today_utc = datetime.datetime.utcnow()
          utc_local_diff = today_utc - datetime.datetime.now()
  
          if time_str.endswith(" UTC"):
              time_str, _ = time_str.split(" UTC")
              utc_time = datetime.datetime.strptime(time_str, '%I:%M %p')
              utc_datetime = datetime.datetime(today_utc.year,
                                               today_utc.month,
                                               today_utc.day,
                                               utc_time.hour,
                                               utc_time.minute)
          else:
              utc_datetime = datetime.datetime.strptime(time_str,
                                                        '%Y-%m-%dT%H:%M:%SZ')
  
          local_time = utc_datetime - utc_local_diff
  
          if use_12_hour_format:
              date_format = '%I:%M %p' if not show_datetime else '%a %d, %I:%M %p'
          else:
              date_format = '%H:%M' if not show_datetime else '%a %d, %H:%M'
  
          return datetime.datetime.strftime(local_time, date_format)
docs: Converts the API UTC time string to the local user time.