docs: def flatten_choices_dict(choices):
      """
      Convert a group choices dict into a flat dict of choices.
  
      flatten_choices({1: '1st', 2: '2nd'}) -> {1: '1st', 2: '2nd'}
      flatten_choices({'Group': {1: '1st', 2: '2nd'}}) -> {1: '1st', 2: '2nd'}
      """
      ret = OrderedDict()
      for key, value in choices.items():
          if isinstance(value, dict):
              # grouped choices (category, sub choices)
              for sub_key, sub_value in value.items():
                  ret[sub_key] = sub_value
          else:
              # choice (key, display value)
              ret[key] = value
      return ret