Wouldn't ``if not shebang.startswith('#!')`` be better (to make sure that it is at the beginning of the string)?