code: def beam_options_to_args(options: dict) -> list[str]:
      """
      Return a formatted pipeline options from a dictionary of arguments.
  
      The logic of this method should be compatible with Apache Beam:
      https://github.com/apache/beam/blob/b56740f0e8cd80c2873412847d0b336837429fb9/sdks/python/
      apache_beam/options/pipeline_options.py#L230-L251
  
      :param options: Dictionary with options
      :return: List of arguments
      """
      if not options:
          return []
  
      args: list[str] = []
      for attr, value in options.items():
          if value is None or (isinstance(value, bool) and value):
              args.append(f"--{attr}")
          elif isinstance(value, list):
              args.extend([f"--{attr}={v}" for v in value])
          else:
              args.append(f"--{attr}={value}")
      return args
  
imports: from __future__ import annotations
  import asyncio
  import contextlib
  import copy
  import functools
  import json
  import os
  import select
  import shlex
  import shutil
  import subprocess
  import tempfile
  import textwrap
  from typing import TYPE_CHECKING, Callable
  from packaging.version import Version
  from airflow.exceptions import AirflowConfigException, AirflowException
  from airflow.hooks.base import BaseHook
  from airflow.providers.google.go_module_utils import init_module, install_dependencies
  from airflow.utils.python_virtualenv import prepare_virtualenv
label_desc: Use image node_id 1 for calling a global function with example usage: beam_options_to_args(options) and returns: args, list