def METHOD_NAME(gtree, sptree, inplace=False):
    """
    Reconciles the gene tree with the species tree
    using Zmasek and Eddy's algorithm. Details can be
    found in the paper:
    Christian M. Zmasek, Sean R. Eddy: A simple algorithm
    to infer gene duplication and speciation events on a
    gene tree. Bioinformatics 17(9): 821-828 (2001)
    :argument gtree: gene tree (PhyloTree instance)
    :argument sptree: species tree (PhyloTree instance)
    :argument False inplace: if True, the provided gene tree instance is
       modified. Otherwise a reconciled copy of the gene tree is returned.
    :returns: reconciled gene tree
    """
    # some cleanup operations
    def cleanup(tree):
        for node in tree.traverse(): node.del_prop("M")
    if not inplace:
        gtree = gtree.copy('deepcopy')
    # check for missing species
    missing_sp = gtree.get_species() - sptree.get_species()
    if missing_sp:
        raise KeyError("* The following species are not contained in the species tree: "+ ', '.join(missing_sp))
    # initialization
    sp2node = dict()
    for node in sptree.leaves(): sp2node[node.species] = node
    # set/compute the mapping function M(g) for the
    # leaf nodes in the gene tree (see paper for details)
    species = sptree.get_species()
    for node in gtree.leaves():
        node.add_prop("M",sp2node[node.species])
    # visit each internal node in the gene tree
    # and detect its event (duplication or speciation)
    for node in gtree.traverse(strategy="postorder"):
        if len(node.children) == 0:
            continue # nothing to do for leaf nodes
        if len(node.children) != 2:
            cleanup(gtree)
            raise ValueError("Algorithm can only work with binary trees.")
        lca = node.children[0].M.get_common_ancestor(node.children[1].M) # LCA in the species tree
        node.add_prop("M",lca)
        node.add_prop("evoltype","S")
        if id(node.children[0].M) == id(node.M) or id(node.children[1].M) == id(node.M):
            node.add_prop("evoltype", "D")
    cleanup(gtree)
    return gtree