def get_correct_narrative_timestep(
        sim_yr,
        narrative_timesteps
    ):
    """Based on simulated year select the correct
    narrative timestep, i.e. the year which is
    to be used from the narrative

    Arguments
    ---------
    sim_yr : int
        Simulation year
    narrative_timesteps : list
        All defined timesteps in narrative

    Returns
    -------
    timestep : int
        Narrative timestep to use for calculation

    Example
    -------
    If we have a two-step narrative such as:
        year: 2015 - 2030, 2030 - 2050

    for the sim_yr 2020, the calculated values for
    2030 would need to be used. For the year 2031,
    the values 2050 would need to be used.
    """
    narrative_timesteps.sort()

    # Get corresponding narrative timestep
    if len(narrative_timesteps) == 1:
        timestep = narrative_timesteps[0]

        return timestep
    else:
        # Test if current year is larger than any narrative_timestep
        # and use last defined timestep if this is true. Otherwise
        # get correct timestep from narrative_timesteps
        if sim_yr > narrative_timesteps[-1]:
            timestep = narrative_timesteps[-1]
        else:
            for year_narrative in narrative_timesteps:

                if sim_yr <= year_narrative:
                    timestep = year_narrative

                    return timestep