def igrep(ip,arg):
    elems = shlex.split(arg)
    dummy, pat, fs = elems[0], elems[1], mglob.expand(elems[2:])
    res = []
    for f in fs:
        found = False
        for l in open(f):
            if pat.lower() in l.lower():
                if not found:
                    print("[[",f,"]]")
                    found = True
                    res.append(f)
                print(l.rstrip())
    return res
igrep PAT files...
dataset/ETHPy150Open ipython/ipython-py3k/IPython/quarantine/ipy_fsops.py/igrep