code: async def unlock(self, device):
          
          device = self._find_device(device)
          if not self.is_handleable(device) or not device.is_crypto:
              self._log.warn(_('not unlocking {0}: unhandled device', device))
              return False
          if device.is_unlocked:
              self._log.info(_('not unlocking {0}: already unlocked', device))
              return True
          if not self._prompt:
              self._log.error(_('not unlocking {0}: no password prompt', device))
              return False
          unlocked = await self._unlock_from_cache(device)
          if unlocked:
              return True
          unlocked = await self._unlock_from_keyfile(device)
          if unlocked:
              return True
          options = dict(allow_keyfile=self.udisks.keyfile_support,
                         allow_cache=self._cache is not None,
                         cache_hint=self._cache_hint)
          password = await self._prompt(device, options)
          # password can be: None, str, or udiskie.prompt.PasswordResult
          cache_hint = getattr(password, 'cache_hint', self._cache_hint)
          password = getattr(password, 'password', password)
          if password is None:
              self._log.debug(_('not unlocking {0}: cancelled by user', device))
              return False
          if isinstance(password, bytes):
              self._log.debug(_('unlocking {0} using keyfile', device))
              await device.unlock_keyfile(password)
          else:
              self._log.debug(_('unlocking {0}', device))
              await device.unlock(password)
          self._update_cache(device, password, cache_hint)
          self._log.info(_('unlocked {0}', device))
          return True
docs: Unlock the device if not already unlocked.
  
          :param device: device object, block device path or mount path
          :returns: whether the device is unlocked