def METHOD_NAME(self, alignment):
    """Return 'protein', 'dna', or 'rna' based on records' molecule type (PRIVATE).
    All the records must have a molecule_type annotation, and they must
    agree.
    Raises an exception if this is not possible.
    """
    values = {_.annotations.get("molecule_type", None) for _ in alignment}
    if all(_ and "DNA" in _ for _ in values):
        return "dna"  # could have been a mix of "DNA" and "gDNA"
    elif all(_ and "RNA" in _ for _ in values):
        return "rna"  # could have been a mix of "RNA" and "mRNA"
    elif all(_ and "protein" in _ for _ in values):
        return "protein"
    else:
        raise ValueError("Need the molecule type to be defined")