def METHOD_NAME(part: Object) -> Object:
    """
    Get a partition's device number.
    :param part: ``struct block_device *`` or ``struct hd_struct *`` depending
        on the kernel version.
    :return: ``dev_t``
    """
    try:
        return part.bd_dev
    except AttributeError:
        return part.__dev.devt