parameters: (serial, serial_map, devtree)
docstring: Maps phone serial number to TTY path, assuming serial map is provided.
docstring_summary: Maps phone serial number to TTY path, assuming serial map is provided.
docstring_tokens: Maps phone serial number to TTY path assuming serial map is provided .
function: def _PhoneToPathMap(serial, serial_map, devtree):
    """Maps phone serial number to TTY path, assuming serial map is provided."""
    try:
      battor_serial = serial_map[serial]
    except KeyError:
      raise battor_error.BattorError('Serial number not found in serial map.')
    for tree in devtree.values():
      for node in tree.AllNodes():
        if isinstance(node, find_usb_devices.USBDeviceNode):
          if node.serial == battor_serial:
            bus_device_to_tty = find_usb_devices.GetBusDeviceToTTYMap()
            bus_device = (node.bus_num, node.device_num)
            try:
              return bus_device_to_tty[bus_device]
            except KeyError:
              raise battor_error.BattorError(
                  'Device with given serial number not a BattOr '
                  '(does not have TTY path)')
function_tokens: def _PhoneToPathMap ( serial , serial_map , devtree ) : try : battor_serial = serial_map [ serial ] except KeyError : raise battor_error . BattorError ( 'Serial number not found in serial map.' ) for tree in devtree . values ( ) : for node in tree . AllNodes ( ) : if isinstance ( node , find_usb_devices . USBDeviceNode ) : if node . serial == battor_serial : bus_device_to_tty = find_usb_devices . GetBusDeviceToTTYMap ( ) bus_device = ( node . bus_num , node . device_num ) try : return bus_device_to_tty [ bus_device ] except KeyError : raise battor_error . BattorError ( 'Device with given serial number not a BattOr ' '(does not have TTY path)' )