def combine_periods_and_elements(periods, elements):
    """
    combine information on periods and orbital elements
    """
    missing = set(periods.keys()) - set(elements.keys())
    if len(missing) > 0:
        raise KeyError('missing orbital elements for: {:}'.format(missing))

    all_data = dict()
    for (id_, (period, flag)) in periods.items():
        all_data[id_] = {
            'period': period,
            'period_flag': flag,
            **elements[id_]}

    return all_data