def is_python_script(filename):
    '''Checks a file to see if it's a python script of some sort.
    '''
    if filename.lower().endswith('.py'):
        return True
    if not os.path.isfile(filename):
        return False
    try:
        with open(filename, 'rb') as fp:
            if fp.read(2) != b'
                return False
            return re.match(r'.*python', str_(fp.readline()))
    except IOError:
        pass
    return False