def alias(attrname):
    """
    Returns a function which calls 'attrname' - for function aliasing.
    We can't just use foo = bar, as this breaks subclassing.
    """

    def func(self, *args, **kwds):
        return getattr(self, attrname)(*args, **kwds)
    return func