def get_shebang(tokens):
    """
    Returns the shebang string in *tokens* if it exists.  None if not.
    """
    # This (short) loop preserves shebangs and encoding strings:
    for tok in tokens[0:4]: # Will always be in the first four tokens
        line = tok[4]
        # Save the first comment line if it starts with a shebang
        # (e.g. '#!/usr/bin/env python')
        if shebang.match(line): # Must be first line
            return line
def get_shebang ( tokens ) : for tok in tokens [ 0 : 4 ] : line = tok [ 4 ] if shebang . match ( line ) : return line
Returns the shebang string in *tokens* if it exists.  None if not.