def _is_valid_dev_type(device_info, vg):
    """Returns bool value if we should use device based on different rules:

    1. Should have approved MAJOR number
    2. Shouldn't be nbd/ram/loop device
    3. Should contain DEVNAME itself
    4. Should be compared with vg value

    :param device_info: A dict of properties which we get from udevadm.
    :param vg: determine if we need LVM devices or not.
    :returns: bool if we should use this device.
    """
    if (
        'E: MAJOR' in device_info and
        int(device_info['E: MAJOR']) not in VALID_MAJORS
    ):
        # NOTE(agordeev): filter out cd/dvd drives and other
        # block devices in which bareon aren't interested
        return False

    if any(
        os.path.basename(device_info['E: DEVNAME']).startswith(n)
        for n in ('nbd', 'ram', 'loop')
    ):
        return False

    if 'E: DEVNAME' not in device_info:
        return False

    if (vg and 'E: DM_VG_NAME' == device_info or
       not vg and 'E: DM_VG_NAME' not in device_info):
        return True
    else:
        return False
dataset/ETHPy150Open openstack/bareon/bareon/utils/hardware.py/_is_valid_dev_type/operator `in` -> `==`