@classmethod
def _getalias(cls, aliases, tree):
    """If tree looks like an unexpanded alias, return (alias, pattern-args)
        pair. Return None otherwise.
        """
    if not isinstance(tree, tuple):
        return None
    if tree[0] == cls._symbolnode:
        name = tree[1]
        a = aliases.get(name)
        if a and a.args is None:
            return a, None
    func = cls._trygetfunc(tree)
    if func:
        name, args = func
        a = aliases.get(name)
        if a and a.args is not None:
            return a, args
    return None
