def get_edge_label_dict(graph, attr_type="label"):
    """ Return a dict with edge tuple as key and edge attr/label as
    value. If both are required, the label will be the first entry in
    the list, and the remaining attributes will come after"""
    d = {}

    if len(graph.es.attributes()) > 0:
        if len(attr_type) > 0:
            if attr_type == "attribute":
                if "attribute" not in graph.es.attributes():
                    attr_type == "weight"
            for e in graph.es:
                if attr_type == "label":
                    d[(e.source, e.target)] = int(e[attr_type])
                    d[(e.target, e.source)] = int(e[attr_type])
                if attr_type == "attribute" or attr_type == "weight":
                    d[(e.source, e.target)] = e[attr_type]
                    d[(e.target, e.source)] = e[attr_type]
                if attr_type == "both":
                    # concatenate label and attributes
                    label_attr = [e['label']]
                    if "attribute" in graph.es.attributes():
                        label_attr.extend(e['attribute'].tolist())
                    elif "weight" in graph.es.attributes():
                        label_attr.extend(e['weight'].tolist())

                    d[(e.source, e.target)] = label_attr
                    d[(e.target, e.source)] = label_attr
    return(d)