from typing import Union
from typing import List
from typing import Tuple


def get_name_for_interval(name: str, time_interval: Union[List, Tuple]):
    """
    Helper function to create column names from prefix and time interval,

    Example:
        get_name_for_interval(name='aki', time_interval=[-3, 0])
        -> 'aki_from_3_days_before_to_0_days_after'
    """
    start, end = [
        f'{abs(x)}_days_before' if x < 0 else f'{x}_days_after'
        for x in time_interval
    ]
    name = name.lower().replace(' ', '_')
    return f'{name}_from_{start}_to_{end}'