def is_script(filename):
    '''Checks if a file has a hashbang.
    '''
    if not os.path.isfile(filename):
        return False

    try:
        with open(filename, 'rb') as fp:
            return fp.read(2) == b'#!'
    except IOError:
        pass

    return False
Checks if a file has a hashbang.