def format_style(number: int) -> str:
    """ Return an escape code for a style, by number.
        This handles invalid style numbers.
    """
    if str(number) not in _stylenums:
        raise InvalidStyle(number)
    return codeformat(number)