code: def parse_mongo_db_arg(mongo_db):
      g = re.match(get_pattern(), mongo_db).groupdict()
      if g is None:
          raise ValueError(
              'mongo_db argument must have the form "db_name" '
              'or "host:port[:db_name]" but was {}'.format(mongo_db)
          )
  
      kwargs = {}
      if g["host1"]:
          kwargs["url"] = "{}:{}".format(g["host1"], g["port1"])
      elif g["host2"]:
          kwargs["url"] = "{}:{}".format(g["host2"], g["port2"])
  
      if g["priority"] is not None:
          kwargs["priority"] = int(g["priority"])
  
      for p in ["db_name", "collection", "overwrite"]:
          if g[p] is not None:
              kwargs[p] = g[p]
  
      return kwargs
  
imports: from typing import Optional, Union
  import mimetypes
  import os.path
  import pickle
  import re
  import sys
  import time
  from tempfile import NamedTemporaryFile
  import warnings
  import sacred.optional
  from sacred.commandline_options import cli_option
  from sacred.dependencies import get_digest
  from sacred.observers.base import RunObserver
  from sacred.observers.queue import QueueObserver
  from sacred.serializer import flatten
  from sacred.utils import ObserverError, PathType
  import pkg_resources
label_desc: Use image node_id 5 for calling a global function with example usage: parse_mongo_db_arg(mongo_db) and returns: kwargs