def get_term_class(go, alias, is_a):
    """Find the class (P, C or F) of the given GO term."""
    x = alias.get(go, go)
    while x:
        if x in ["GO:0008150", "obsolete_biological_process"]:
            return "P"
        elif x in ["GO:0005575", "obsolete_cellular_component"]:
            return "C"
        elif x in ["GO:0003674", "obsolete_molecular_function"]:
            return "F"
        try:
            x = is_a[x]
        except KeyError:
            return "?"