def convert_device_size(unformatted_size, units_to_covert_to):
    """
    Convert a string representing a size to an int according to the given units
    to convert to

    Args:
        unformatted_size (str): The size to convert (i.e, '1Gi'/'100Mi')
        units_to_covert_to (str): The units to convert the size to (i.e, TB/GB/MB)

    Returns:
        int: The converted size

    """
    units = unformatted_size[-2:]
    abso = int(unformatted_size[:-2])
    conversion = {
        "TB": {"Ti": abso, "Gi": abso / 1000, "Mi": abso / 1e6, "Ki": abso / 1e9},
        "GB": {"Ti": abso * 1000, "Gi": abso, "Mi": abso / 1000, "Ki": abso / 1e6},
        "MB": {"Ti": abso * 1e6, "Gi": abso * 1000, "Mi": abso, "Ki": abso / 1000},
        "KB": {"Ti": abso * 1e9, "Gi": abso * 1e6, "Mi": abso * 1000, "Ki": abso},
        "B": {"Ti": abso * 1e12, "Gi": abso * 1e9, "Mi": abso * 1e6, "Ki": abso * 1000},
    }
    return conversion[units_to_covert_to][units]