from typing import List
from typing import Union


def get_notes_in_scale(all_notes: List[Union[float, int, str]],
                       scale: int) -> List[Union[float, int, str]]:
    """Return a list of all notes in scale, where the notes are chosen from a
    set of all twelve possible semitones.

    Args:
        all_notes: List of strings, integers, or floats that make up the set of
            all twelve semitones.  The list contents could represent notes in
            ABC notation (A, #A, B, ...), frequencies, midi note numbers, etc.
        scale: an integer mask where each '1' bit means the note is present in
            the output scale and a '0' bit means it is not present.  The least
            significant bit always corresponds to the first note in all_notes.

    Returns:
        A list of notes that is a subset of the input all_notes list.

    Raises:
        A ValueError if the scale argument has one or fewer notes or more than
        twelve notes.
    """
    if scale <= 1 or scale > 0xfff:
        raise ValueError(
            'A valid musical scale must include at least two notes and no '
            'more then twelve notes (0x001 to 0xfff)')
    scale_notes = []
    for i, note in enumerate(all_notes):
        if scale & (0x1 << i):
            scale_notes.append(note)
    if len(scale_notes) == 1:
        raise ValueError(
            'Only one note appears in this scale; currently monotonic scales '
            'are not supported')
    return scale_notes