code: def get_algorithm_config(xs):
      
      if isinstance(xs, dict):
          xs = [xs]
      for x in xs:
          if is_std_config_arg(x):
              return x["algorithm"]
          elif is_nested_config_arg(x):
              return x["config"]["algorithm"]
          elif isinstance(x, (list, tuple)) and is_nested_config_arg(x[0]):
              return x[0]["config"]["algorithm"]
      raise ValueError("Did not find algorithm configuration in items: {0}"
                       .format(pprint.pformat(xs)))
docs: Flexibly extract algorithm configuration for a sample from any function arguments.