input: Write a Python function `get_latest_12hr_time(time_str: str) -> str:` which takes an input string in a 12-hour format time with some digits possibly replaced by "?" and returns the latest possible valid time by replacing "?" with appropriate digits. The string format is "HH:MM", where HH ranges from 00 to 11 and MM from 00 to 59. The function ensures the final time is the most recent possible within the 12-hour time constraints.
  
  Examples:
  >>> time_str = "1?:?4"
  "11:54"
  >>> time_str = "0?:5?"
  "09:59"
  
  Constraints:
  - The length of the time_str is 5.
  - The third character of time_str is ":".
  - All characters except the third one are either digits or "?".
  - There is guaranteed to be at least one valid time between "00:00" and "11:59" obtainable by replacing "?" characters.
output: def get_latest_12hr_time(time_str: str) -> str:
      hh, mm = time_str.split(':')
      if hh[0] == '?':
          if hh[1] == '?' or int(hh[1]) <= 1:
              hh = '11' if hh[1] == '?' else '1' + hh[1]
          else:
              hh = '0' + hh[1]
      if hh[1] == '?':
          hh = hh[0] + '1' if hh[0] == '1' else hh[0] + '9'
      if mm[0] == '?':
          mm = '5' + mm[1]
      if mm[1] == '?':
          mm = mm[0] + '9'
      return hh + ':' + mm