code: def extract_valid_args(args, func, startidx=0):
      """
      Given a namespace of argparser args, extract those applicable to func.
  
      Arguments:
          args (Namespace): a namespace of args from argparse
          func (Function): a function to inspect, to determine valid args
          startidx (int): Start index
  
      Returns:
          dict of (arg, value) pairs from args that are valid for func
      """
      func_args = inspect.getargspec(func).args[startidx:]
      return dict(
          (k, v) for k, v in list(vars(args).items()) if k in func_args
      )
  
imports: import configargparse
  import logging
  from logging.handlers import RotatingFileHandler
  import numpy
  import os
  import inspect
  from neon import __version__
  from neon.backends import gen_backend
  from neon.backends.backend import Backend
  from neon.backends.util.check_gpu import get_compute_capability, get_device_count
  from neon.backends.util.check_mkl import get_mkl_lib
  from neon.callbacks.callbacks import Callbacks
label_desc: Use image node_id 1 for calling a global function with example usage: extract_valid_args(args, func, startidx) and returns: dict