code: def parse_lms_api_datetime(datetime_string, datetime_format=LMS_API_DATETIME_FORMAT):
      
      if isinstance(datetime_string, datetime.datetime):
          date_time = datetime_string
      else:
          try:
              date_time = datetime.datetime.strptime(datetime_string, datetime_format)
          except ValueError:
              date_time = datetime.datetime.strptime(datetime_string, LMS_API_DATETIME_FORMAT_WITHOUT_TIMEZONE)
  
      # If the datetime format didn't include a timezone, then set to UTC.
      # Note that if we're using the default LMS_API_DATETIME_FORMAT, it ends in 'Z',
      # which denotes UTC for ISO-8661.
      if date_time.tzinfo is None:
          date_time = date_time.replace(tzinfo=timezone.utc)
      return date_time
docs: Parse a received datetime into a timezone-aware, Python datetime object.
  
      Arguments:
          datetime_string: A string to be parsed.
          datetime_format: A datetime format string to be used for parsing