(relationships)
parse stix relationships into appropriate data structures.

    arguments:
        relationships: list of stix-formatted relationship dicts
parse stix relationships into appropriate data structures.
parse stix relationships into appropriate data structures .
def parse_relationships(relationships):
    """parse stix relationships into appropriate data structures.

    arguments:
        relationships: list of stix-formatted relationship dicts
    """

    # Iterate over each relationship
    for obj in relationships:
        # Load the source and target STIX IDs
        src=obj['source_ref']
        tgt=obj['target_ref']
        # Handle each case
        if src in id_to_tech and tgt in id_to_group:
            add_link(id_to_tech[src], id_to_group[tgt], tech_to_group, group_to_tech)
        if src in id_to_tech and tgt in id_to_software:
            add_link(id_to_tech[src], id_to_software[tgt], tech_to_software, software_to_tech)
        if src in id_to_software and tgt in id_to_group:
            add_link(id_to_software[src], id_to_group[tgt], software_to_group, group_to_software)
        if src in id_to_software and tgt in id_to_tech:
            add_link(id_to_software[src], id_to_tech[tgt], software_to_tech, tech_to_software)
        if src in id_to_group and tgt in id_to_tech:
            add_link(id_to_group[src], id_to_tech[tgt], group_to_tech, tech_to_group)
        if src in id_to_group and tgt in id_to_software:
            add_link(id_to_group[src], id_to_software[tgt], group_to_software, software_to_group)
def parse_relationships ( relationships ) : # Iterate over each relationship for obj in relationships : # Load the source and target STIX IDs src = obj [ 'source_ref' ] tgt = obj [ 'target_ref' ] # Handle each case if src in id_to_tech and tgt in id_to_group : add_link ( id_to_tech [ src ] , id_to_group [ tgt ] , tech_to_group , group_to_tech ) if src in id_to_tech and tgt in id_to_software : add_link ( id_to_tech [ src ] , id_to_software [ tgt ] , tech_to_software , software_to_tech ) if src in id_to_software and tgt in id_to_group : add_link ( id_to_software [ src ] , id_to_group [ tgt ] , software_to_group , group_to_software ) if src in id_to_software and tgt in id_to_tech : add_link ( id_to_software [ src ] , id_to_tech [ tgt ] , software_to_tech , tech_to_software ) if src in id_to_group and tgt in id_to_tech : add_link ( id_to_group [ src ] , id_to_tech [ tgt ] , group_to_tech , tech_to_group ) if src in id_to_group and tgt in id_to_software : add_link ( id_to_group [ src ] , id_to_software [ tgt ] , group_to_software , software_to_group )