code: def copy_to_dict(self, dictionary, prefix=None):
      # iterate over keys and merge values according to parameter type in dictionary
      # add dict prefix
      prefix = prefix  # or self._prefix_dict
      if prefix:
          prefix = prefix.strip(self._prefix_sep) + self._prefix_sep
          parameters = dict(
              [
                  (k[len(prefix) :], v)
                  for k, v in self._task.get_parameters().items()
                  if k.startswith(prefix)
              ]
          )
          # noinspection PyProtectedMember
          parameters_type = {
              k: p.type
              for k, p in (
                  (
                      self._task._get_task_property(
                          "hyperparams", raise_on_error=False
                      )
                      or {}
                  ).get(prefix[: -len(self._prefix_sep)])
                  or {}
              ).items()
              if p.type
          }
      else:
          parameters_type = {}
          parameters = dict(
              [
                  (k, v)
                  for k, v in self._task.get_parameters().items()
                  if not k.startswith(self._prefix_tf_defines)
              ]
          )
  
      for k, v in dictionary.items():
          # if key is not present in the task's parameters, assume we didn't get this far when running
          # in non-remote mode, and just add it to the task's parameters
          if k not in parameters:
              self._task.set_parameter((prefix or "") + k, v)
              continue
  
          param = parameters.get(k, None)
          if param is None:
              continue
  
          # if default value is not specified, allow casting based on what we have on the Task
          if v is not None:
              v_type = type(v)
          elif parameters_type.get(k):
              v_type_str = parameters_type.get(k)
              v_type = get_type_from_basic_type_str(v_type_str)
          else:
              # this will be type(None), we deal with it later
              v_type = type(v)
  
          def warn_failed_parsing():
              self._task.log.warning(
                  "Failed parsing task parameter {}={} keeping default {}={}".format(
                      k, param, k, v
                  )
              )
  
          # if parameter is empty and default value is None, keep as None
          if param == "" and v is None:
              v_type = type(None)
          elif (
              v_type == int
          ):  # assume more general purpose type int -> float
              if v is not None and int(v) != float(v):
                  v_type = float
          elif v_type == bool:
              # cast based on string or int
              try:
                  param = bool(float(param))
              except ValueError:
                  try:
                      param = str(param).lower().strip() == "true"
                  except ValueError:
                      warn_failed_parsing()
                      continue
          elif v_type == list:
              # noinspection PyBroadException
              try:
                  p = str(param).strip()
                  param = yaml.load(p, Loader=FloatSafeLoader)
              except Exception:
                  warn_failed_parsing()
                  continue
          elif v_type == tuple:
              # noinspection PyBroadException
              try:
                  p = (
                      str(param)
                      .strip()
                      .replace("(", "[", 1)[::-1]
                      .replace(")", "]", 1)[::-1]
                  )
                  param = tuple(yaml.load(p, Loader=FloatSafeLoader))
              except Exception:
                  warn_failed_parsing()
                  continue
          elif v_type == dict:
              # noinspection PyBroadException
              try:
                  p = str(param).strip()
                  param = yaml.load(p, Loader=FloatSafeLoader)
              except Exception:
                  warn_failed_parsing()
          elif issubclass(v_type, Enum):
              # noinspection PyBroadException
              try:
                  param = getattr(v_type, param).value
              except Exception:
                  warn_failed_parsing()
                  continue
  
          # noinspection PyBroadException
          try:
              # do not change this comparison because isinstance(v_type, type(None)) === False
              if v_type == type(None):  # noqa: E721
                  dictionary[k] = str(param) if param else None
              elif v_type == str:  # noqa: E721
                  dictionary[k] = v_type(param)
              else:
                  dictionary[k] = None if param == "" else v_type(param)
          except Exception:
              warn_failed_parsing()
              continue
      # add missing parameters to dictionary
      # for k, v in parameters.items():
      #     if k not in dictionary:
      #         dictionary[k] = v
  
      if not isinstance(dictionary, self._ProxyDictReadOnly):
          return self._ProxyDictReadOnly(self, prefix, **dictionary)
      return dictionary
  
imports: import yaml
  from enum import Enum
  from inspect import isfunction
  from six import PY2
  from argparse import _StoreAction, ArgumentError, _StoreConstAction, _SubParsersAction, _AppendAction, SUPPRESS
  from copy import copy
  from typing import Tuple, Type, Union
  from ...backend_api import Session
  from ...binding.args import call_original_argparser
  from ...utilities.proxy_object import get_type_from_basic_type_str
label_desc: Use image node_id 13 for calling the _Arguments obj's underlying member method code with example usage: obj.copy_to_dict(dictionary, prefix) and returns: dictionary, self