def add_secondary_structure_to_polymers(model, ss_dict):
    """Updates polymer dictionaries with secondary structure information, from
    a previously created mapping.

    :param dict model: the model to update.
    :param dict ss_dict: the mapping to read."""
    for ss in ('helices', 'strands'):
        for segment in ss_dict[ss]:
            chain = model['polymer'].get(segment[0][0])
            if chain:
                in_segment = False
                chain[ss].append([])
                for residue_id in chain['residues'].keys():
                    if residue_id == segment[0]:
                        in_segment = True
                    if in_segment:
                        chain[ss][-1].append(residue_id)
                    if residue_id == segment[1]:
                        break
