def get_device(self, identifier):
        if identifier is None:
            return None

        use_key = False
        if isinstance(identifier, str):
            if identifier.startswith(BASE_PATH):
                return self._bus.get(SERVICE, identifier)

            if re.match(r'\w{4}:\w{4}.\d{2}', identifier):
                use_key = True
            elif re.match(r'\d+', identifier):
                identifier = int(identifier)
            else:
                return None

        for dev_path in self.get_device_paths():
            dev = self.get_device(dev_path)
            if use_key and identifier == dev.Key:
                return dev
            elif identifier == dev.DeviceIndex:
                return dev

        return None