code: def encoding_and_executable(notebook, metadata, ext):
      """Return encoding and executable lines for a notebook, if applicable"""
      lines = []
      comment = _SCRIPT_EXTENSIONS.get(ext, {}).get("comment")
      jupytext_metadata = metadata.get("jupytext", {})
  
      if comment is not None and "executable" in jupytext_metadata:
          lines.append("#!" + jupytext_metadata.pop("executable"))
  
      if comment is not None:
          if "encoding" in jupytext_metadata:
              lines.append(jupytext_metadata.pop("encoding"))
          elif (
              default_language_from_metadata_and_ext(metadata, ext)
              != "python"
          ):
              for cell in notebook.cells:
                  try:
                      cell.source.encode("ascii")
                  except (UnicodeEncodeError, UnicodeDecodeError):
                      lines.append(comment + _UTF8_HEADER)
                      break
  
      return lines
  
file_path: jupytext/src/jupytext/header.py
imports: import re
  import nbformat
  import yaml
  from nbformat.v4.nbbase import new_raw_cell
  from yaml.representer import SafeRepresenter
  from .languages import _SCRIPT_EXTENSIONS, comment_lines, default_language_from_metadata_and_ext
  from .metadata_filter import _DEFAULT_NOTEBOOK_METADATA, filter_metadata
  from .pep8 import pep8_lines_between_cells
  from .version import __version__
label_desc: Use image node_id 3 for calling a global function with example usage: encoding_and_executable(notebook, metadata, ext) and returns: lines