code: def mode_mapping_byname(mav_type):
      '''return dictionary mapping mode names to numbers, or None if unknown'''
      map = None
      if mav_type in [mavlink.MAV_TYPE_QUADROTOR,
                      mavlink.MAV_TYPE_HELICOPTER,
                      mavlink.MAV_TYPE_HEXAROTOR,
                      mavlink.MAV_TYPE_OCTOROTOR,
                      mavlink.MAV_TYPE_COAXIAL,
                      mavlink.MAV_TYPE_TRICOPTER]:
          map = mode_mapping_acm
      if mav_type == mavlink.MAV_TYPE_FIXED_WING:
          map = mode_mapping_apm
      if mav_type == mavlink.MAV_TYPE_GROUND_ROVER:
          map = mode_mapping_rover
      if mav_type == mavlink.MAV_TYPE_ANTENNA_TRACKER:
          map = mode_mapping_tracker
      if map is None:
          return None
      inv_map = dict((a, b) for (b, a) in map.items())
      return inv_maf mode_mapping_byname(mav_type):
      '''return dictionary mapping mode names to numbers, or None if unknown'''
      map = None
      if mav_type in [mavlink.MAV_TYPE_QUADROTOR,
                      mavlink.MAV_TYPE_HELICOPTER,
                      mavlink.MAV_TYPE_HEXAROTOR,
                      mavlink.MAV_TYPE_OCTOROTOR,
                      mavlink.MAV_TYPE_COAXIAL,
                      mavlink.MAV_TYPE_TRICOPTER]:
          map = mode_mapping_acm
      if mav_type == mavlink.MAV_TYPE_FIXED_WING:
          map = mode_mapping_apm
      if mav_type == mavlink.MAV_TYPE_GROUND_ROVER:
          map = mode_mapping_rover
      if mav_type == mavlink.MAV_TYPE_ANTENNA_TRACKER:
          map = mode_mapping_tracker
      if map is None:
          return None
      inv_map = dict((a, b) for (b, a) in map.items())
      return inv_map
docs: return dictionary mapping mode names to numbers, or None if unknown