code: def load_device(self, serial=None):
          
          serials = android_device.list_adb_devices()
          if not serials:
              raise Error('No adb device found!')
          # No serial provided, try to pick up the device automatically.
          if not serial:
              env_serial = os.environ.get('ANDROID_SERIAL', None)
              if env_serial is not None:
                  serial = env_serial
              elif len(serials) == 1:
                  serial = serials[0]
              else:
                  raise Error(
                      'Expected one phone, but %d found. Use the -s flag or '
                      'specify ANDROID_SERIAL.' % len(serials))
          if serial not in serials:
              raise Error('Device "%s" is not found by adb.' % serial)
          ads = android_device.get_instances([serial])
          assert len(ads) == 1
          self._ad = ads[0]
docs: Creates an AndroidDevice for the given serial number.
  
          If no serial is given, it will read from the ANDROID_SERIAL
          environmental variable. If the environmental variable is not set, then
          it will read from 'adb devices' if there is only one.