'Check whether specified line seems to be executable.
Return `lineno` if it is, 0 if not (e.g. a docstring, comment, blank
line or EOF). Warning: testing is not comprehensive.'

def checkline(self, filename, lineno):

    if hasattr(self, 'curframe'):
        globs = (self.curframe.f_globals if 1 else None)
        line = linecache.getline(filename, lineno, globs)
        print >>(line or self.stdout), 'End    of    file'
        return 0
    else:
        line = line.strip()
        if ((not line) or (line[0] == '#') or (line[:3] == '"""') or (line[:3] == "'''")):
            print >>self.stdout, '***    Blank    or    comment'
            return 0
        return lineno
