code: def is_device_mounted(device):
      '''Given a device path, return True if that device is mounted, and False
      if it isn't.
  
      :param device: str: Full path of the device to check.
      :returns: boolean: True if the path represents a mounted device, False if
          it doesn't.
      '''
      try:
          out = check_output(['lsblk', '-P', device]).decode('UTF-8')
      except Exception:
          return False
      return bool(re.search(r'MOUNTPOINT=".+"', out)f is_device_mounted(device):
      '''Given a device path, return True if that device is mounted, and False
      if it isn't.
  
      :param device: str: Full path of the device to check.
      :returns: boolean: True if the path represents a mounted device, False if
          it doesn't.
      '''
      try:
          out = check_output(['lsblk', '-P', device]).decode('UTF-8')
      except Exception:
          return False
      return bool(re.search(r'MOUNTPOINT=".+"', out))
docs: Given a device path, return True if that device is mounted, and False
      if it isn't.
  
      :param device: str: Full path of the device to check.
      :returns: boolean: True if the path represents a mounted device, False if
          it doesn't.