Write a new shebang to the file.

        Raises:
            ValueError: If the file has no shebang to modify.
            ValueError: If the new shebang is invalid.

def shebang(self, new_shebang):
        """Write a new shebang to the file.

        Raises:
            ValueError: If the file has no shebang to modify.
            ValueError: If the new shebang is invalid.
        """
        if not self.shebang:

            raise ValueError('Cannot modify a shebang if it does not exist.')

        if not new_shebang.startswith('#!'):

            raise ValueError('Invalid shebang.')

        self.writeline(new_shebang, 0)