Get device using the specified ID, or None if not found.
164598
def get(self, device_id: int) -> Optional[Device]:
        """"""
        return self._devices.get(device_id)
782960
public function getDeviceIdByCustomId($id)
    {
        $devices = $this->getPairedDevices();

        foreach ($devices as $device) {
            if (strtolower($device['id']) === strtolower($id)) {
                return $device['DeviceID'];
            }
        }

        return null;
    }
841837
def _get_one(self, id):
        
        try:
            return self._to_dict(models.User.objects.get(pk=id))
        except models.User.DoesNotExist:
            raise errors.NotFound()
474325
public DeviceEnvelope getDevice(String deviceId) throws ApiException {
        ApiResponse<DeviceEnvelope> resp = getDeviceWithHttpInfo(deviceId);
        return resp.getData();
    }
1242065
def _get_device_info(self, device_id):
        """"""
        params = {'access_token': self.access_token}
        r = self.spark_api(device_id).GET(params=params, timeout=30)
        self._check_error(r)
        return r.json()
415170
def _device_lookup(self, device_name):
        '''  '''
        device_found = {}
        response = requests.get(self._api_url + 'devices',
                                auth=(self._api_key, ''))
        if response.ok:
            for device in response.json()['devices']:
                if device_name == device['extras']['model']:
                    #TODO Check device['extras']['nickname'] as well
                    device_found = device
        return device_found
340630
def DeviceGet(self, device_id):
        
        if self.__SenseApiCall__('/devices/{0}'.format(device_id), 'GET'):
            return True
        else:
            self.__error__ = "api call unsuccessful"
            return False
818546
public static function getDeviceIpById($id)
    {
        $device = Discovery::lookupDevice('id', $id);
        if (isset($device['ip'])) {
            return $device['ip'];
        }
        throw new \Exception('Invalid device id supplied. No device found by id ' . $id);
    }
181445
def get_device_index_based_on_prompt(self, prompt):
        """"""
        conn_info = ""
        for device in self.devices:
            conn_info += str(device) + "->"
            if device.prompt == prompt:
                self.connection.log("Connected: {}".format(conn_info))
                return self.devices.index(device)
        else:
            return None
756462
def devid(self):
        
        d = self.device
        vend_id = d.get('ID_VENDOR_ID')
        model_id = d.get('ID_MODEL_ID')
        return (vend_id, model_id)
976635
def get(cls, id):
        

        # cached?
        if CACHE:
            if id in _cache['Prefix']:
                log.debug('cache hit for prefix %d' % id)
                return _cache['Prefix'][id]
            log.debug('cache miss for prefix %d' % id)

        try:
            prefix = Prefix.list({'id': id})[0]
        except IndexError:
            raise NipapNonExistentError('no prefix with ID ' + str(id) + ' found')

        _cache['Prefix'][id] = prefix
        return prefix
432231
def get_device_element(self, ain):
        """"""
        elements = self.get_device_elements()
        for element in elements:
            if element.getAttribute('identifier') == ain:
                return element
        return None
751630
def __read_device(self):
        """"""
        state = XinputState()
        res = self.manager.xinput.XInputGetState(
            self.__device_number, ctypes.byref(state))
        if res == XINPUT_ERROR_SUCCESS:
            return state
        if res != XINPUT_ERROR_DEVICE_NOT_CONNECTED:
            raise RuntimeError(
                "Unknown error %d attempting to get state of device %d" % (
                    res, self.__device_number))
        # else (device is not connected)
        return None
932106
def find(self, path):
        
        if isinstance(path, Device):
            return path
        for device in self:
            if device.is_file(path):
                self._log.debug(_('found device owning "{0}": "{1}"',
                                  path, device))
                return device
        raise FileNotFoundError(_('no device found owning "{0}"', path))
125582
def get_connection_by_id(self, id):
        ''''''
        with self._mutex:
            for conn in self.connections:
                if conn.id == id:
                    return conn
            return None
750031
def request_device?(device)
      (request.user_agent.to_s.downcase =~ (Mobylette.devices.device(device) || %r{not_to_be_matched_please}) ? true : false)
    end
995551
def _on_device_update(self, devid):
        """"""
        if isinstance(devid, (tuple, list)):
            devid = devid[0]

        if devid is None:
            _LOGGER.warning("Device update with no device id.")
            return

        _LOGGER.debug("Device update event for device ID: %s", devid)

        device = self._abode.get_device(devid, True)

        if not device:
            _LOGGER.debug("Got device update for unknown device: %s", devid)
            return

        for callback in self._device_callbacks.get(device.device_id, ()):
            _execute_callback(callback, device)