def sort_sites(structure, method):
    """
    Sorts all elements in 'structure' into different site "types", e.g. A sites,
    B sites, etc. according to the method specified.

    Args
    ----
    structure: pymatgen.core.Structure
        Pymatgen Structure object.

    method: str   
        name of sort_sites() algorithm to use (in sites.py). New custom
        methods should be added to the site.py module so that they are
        callable from the main Structure module.
                    
        (i) "mof": developed for work in Ref 1. Works well for a wide range
            of AB2 MOF structures.

        (ii) "allAtoms": makes each element in structure into its own
            site-type class. e.g. for Tb(HCO2)3, the resultant sites would
            be: 
            
            [["Tb"], ["H"], ["C"], ["O"]] 
            
            (not necessarily in that order).
    """

    # Get elements.
    e = structure.composition.elements

    return eval(f"{method}(structure, e)")