def add_namespaces(spec_dict):
    """Add namespace convenience keys, list, list_{short|long}, to_{short|long}"""

    for ns in spec_dict["namespaces"]:
        spec_dict["namespaces"][ns]["list"] = []
        spec_dict["namespaces"][ns]["list_long"] = []
        spec_dict["namespaces"][ns]["list_short"] = []

        spec_dict["namespaces"][ns]["to_short"] = {}
        spec_dict["namespaces"][ns]["to_long"] = {}

        for obj in spec_dict["namespaces"][ns]["info"]:
            spec_dict["namespaces"][ns]["list"].extend([obj["name"], obj["abbreviation"]])
            spec_dict["namespaces"][ns]["list_short"].append(obj["abbreviation"])
            spec_dict["namespaces"][ns]["list_long"].append(obj["name"])

            spec_dict["namespaces"][ns]["to_short"][obj["abbreviation"]] = obj["abbreviation"]
            spec_dict["namespaces"][ns]["to_short"][obj["name"]] = obj["abbreviation"]

            spec_dict["namespaces"][ns]["to_long"][obj["abbreviation"]] = obj["name"]
            spec_dict["namespaces"][ns]["to_long"][obj["name"]] = obj["name"]

            # For AminoAcid namespace
            if "abbrev1" in obj:
                spec_dict["namespaces"][ns]["to_short"][obj["abbrev1"]] = obj["abbreviation"]
                spec_dict["namespaces"][ns]["to_long"][obj["abbrev1"]] = obj["name"]