def parse_mask(s: str) -> int:
    """Parses an integer, possibly starting with 0b/0o/0x, from a string and returns it.

    Examples:

        >>> parse_mask("10")
        10
        >>> parse_mask("0x10")
        16
        >>> parse_mask("0o10")
        8
        >>> parse_mask("0b10")
        2
        >>> parse_mask("")
        Traceback (most recent call last):
        ...
        ValueError: invalid literal for int() with base 10: ''
    """
    s = s.strip()
    if s.startswith("0x"):
        return int(s[2:], base=16)
    elif s.startswith("0o"):
        return int(s[2:], base=8)
    elif s.startswith("0b"):
        return int(s[2:], base=2)
    return int(s, base=10)