def ls(o, pat=None):
    """like dir, but can filter results with glob pat"""

    names = dir(o)
    if not pat:
        return names

    import fnmatch
    def match(name, fn=fnmatch.fnmatch, pat=pat):
       return fn(name, pat)
    return filter(match, names)
like dir, but can filter results with glob pat
recipes/Python/576389_filtered_interpolation/recipe-576389.py