def _check_device(module, device):
    """
    Check if device already exists and the state.
    Args:
        module: Ansible module.
        device: device to be checked.

    Returns: bool, device state

    """
    lsdev_cmd = module.get_bin_path('lsdev', True)
    rc, lsdev_out, err = module.run_command(['%s' % lsdev_cmd, '-C', '-l', 
        '%s' % device])
    if rc != 0:
        module.fail_json(msg='Failed to run lsdev', rc=rc, err=err)
    if lsdev_out:
        device_state = lsdev_out.split()[1]
        return True, device_state
    device_state = None
    return False, device_state
