<SYSTEM_TASK:>
Solve the following problem using Python, implementing the functions described below, one line at a time
<END_TASK>
<USER_TASK:>
Description:
 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)