code: def _is_chunk_markdown(source):
      
      lines = source.splitlines()
      if all(line.startswith('# ') for line in lines):
          # The chunk is a Markdown *unless* it is commented Python code.
          source = '\n'.join(line[2:] for line in lines
                             if not line[2:].startswith('#'))  # skip headers
          if not source:
              return True
          # Try to parse the chunk: if it fails, it is Markdown, otherwise,
          # it is Python.
          return not _is_python(source)
      return False
docs: Return whether a chunk contains Markdown contents.