def _parse_controller_priority(priority):
    """Parses the controller priority.

    Smaller number means higher priority. Controllers with higher priority will
    be executed first after the running iteration and executed last before the
    running iteration. Priority of controllers can be set in the configeration
    file. All priorities should be with integer type and lie in range [0, 100].

    Followings are some aliases for the default priorities:

    (1) FIRST: 0
    (2) HIGH: 25
    (3) MEDIUM: 50
    (4) LOW: 75
    (5) LAST: 100

    Args:
        priority: An integer or a string (alias) indicating the priority.

    Returns:
        An integer representing the parsed priority.

    Raises:
        TypeError: If the input `priority` is not with `int` or `str` type.
        ValueError: If the input `priority` is out of range [0, 100] or the
            `priority` is an invalid alias.
    """
    if isinstance(priority, int):
        if not 0 <= priority <= 100:
            raise ValueError(f'Controller priority should lie in range '
                             f'[0, 100], but `{priority}` is received!')
        return priority
    if isinstance(priority, str):
        try:
            return _CONTROLLER_PRIORITY_ALIASES[priority.upper()]
        except KeyError:
            raise ValueError(f'Unknown alias `{priority}` for controller '
                             f'priority!\n'
                             f'Please choose from: '
                             f'{list(_CONTROLLER_PRIORITY_ALIASES)}.')
    raise TypeError(f'Input `priority` should be with type `int` or `str`, '
                    f'but `{type(priority)}` is received!')
Parses the controller priority.

    Smaller number means higher priority. Controllers with higher priority will
    be executed first after the running iteration and executed last before the
    running iteration. Priority of controllers can be set in the configeration
    file. All priorities should be with integer type and lie in range [0, 100].

    Followings are some aliases for the default priorities:

    (1) FIRST: 0
    (2) HIGH: 25
    (3) MEDIUM: 50
    (4) LOW: 75
    (5) LAST: 100

    Args:
        priority: An integer or a string (alias) indicating the priority.

    Returns:
        An integer representing the parsed priority.

    Raises:
        TypeError: If the input `priority` is not with `int` or `str` type.
        ValueError: If the input `priority` is out of range [0, 100] or the
            `priority` is an invalid alias.
    
runners/controllers/base_controller.py