code: def parse_directive_options(content, error_msg):
      """Parse (and validate) the directive option section."""
      options = {}
      if content.startswith("---"):
          content = "\n".join(content.splitlines()[1:])
          match = re.search(r"^-{3,}", content, re.MULTILINE)
          if match:
              yaml_block = content[: match.start()]
              content = content[match.end() + 1 :]
          else:
              yaml_block = content
              content = ""
          yaml_block = dedent(yaml_block)
          try:
              options = yaml.safe_load(yaml_block) or {}
          except (
              yaml.parser.ParserError,
              yaml.scanner.ScannerError,
          ) as error:
              raise MystMetadataParsingError(
                  error_msg + "Invalid YAML; " + str(error)
              )
      elif content.lstrip().startswith(":"):
          content_lines = content.splitlines()  # type: list
          yaml_lines = []
          while content_lines:
              if not content_lines[0].lstrip().startswith(":"):
                  break
              yaml_lines.append(content_lines.pop(0).lstrip()[1:])
          yaml_block = "\n".join(yaml_lines)
          content = "\n".join(content_lines)
          try:
              options = yaml.safe_load(yaml_block) or {}
          except (
              yaml.parser.ParserError,
              yaml.scanner.ScannerError,
          ) as error:
              raise MystMetadataParsingError(
                  error_msg + "Invalid YAML; " + str(error)
              )
  
      return content.splitlines(), options
  
imports: import json
  import re
  import warnings
  from textwrap import dedent
  import nbformat
  import yaml
  from .cell_to_text import three_backticks_or_more
label_desc: Use image node_id 13 for calling a global function with example usage: parse_directive_options(content, error_msg) and returns: content,  options