def bitmask_to_numbered_list(mask):
    """Convert a bitmask to a numbered list

    Args:
        mask (int): the mask returned by the API

    Returns:
        list: list of integers

    """
    if mask is None:
        return []

    return [
        i+1
        for i in range(mask.bit_length() + 1)
        if bool(mask >> i & 1)
    ]