from typing import List
def my_func(l: List[int]):
pass
# use typing.Literal - mode expects either 'a' or 'b'
from typing import Literal
def func(mode: Literal['a', 'b'] = 'a'):
if mode not in ['a', 'b']:
raise AttributeError('Not OK')