def get_agegroups_from_breakpoints(breakpoints):
    """
    This function consolidates get_strat_from_breakpoints from Romain's age_strat module and define_age_structure from
    James' model.py method into one function that can return either a dictionary or a list for the model stratification.
    (One reason for using this approach rather than Romain's is that the lists need to be ordered for model.py.)

    Args:
        breakpoints: The age group cut-offs.
    Returns:
        agegroups: List of the strings describing the age groups only.
        agegroups_dict: List with strings of agegroups as keys with values being
            lists of the lower and upper age cut-off for that age group.
    """

    # initialise
    agegroups = []
    agegroups_dict = {}

    if len(breakpoints) > 0:
        for i in range(len(breakpoints)):

            # the first age-group
            if i == 0:
                agegroup_string = '_age0to' + str(int(breakpoints[i]))
                agegroups_dict[agegroup_string] = [0., float(breakpoints[i])]

            # middle age-groups
            else:
                agegroup_string = '_age' + str(int(breakpoints[i - 1])) + 'to' + str(int(breakpoints[i]))
                agegroups_dict[agegroup_string] = [float(breakpoints[i - 1]),
                                                   float(breakpoints[i])]
            agegroups += [agegroup_string]

        # last age-group
        agegroup_string = '_age' + str(int(breakpoints[-1])) + 'up'
        agegroups_dict[agegroup_string] = [float(breakpoints[-1]),
                                           float('inf')]
        agegroups += [agegroup_string]

    # if no age groups
    else:
        # list consisting of one empty string required for methods that iterate over strains
        agegroups += ['']

    return agegroups, agegroups_dict