code: def get_optional_arg_from_config(cp, section, arg, dtype=str):
      
      if cp.has_option(section, arg):
          val = dtype(cp.get(section, arg))
      else:
          val = None
      return val
docs: Convenience function to retrieve an optional argument from a config
      file.
  
      Parameters
      ----------
      cp : ConfigParser
          Open config parser to retrieve the argument from.
      section : str
          Name of the section to retrieve from.
      arg : str
          Name of the argument to retrieve.
      dtype : datatype, optional
          Cast the retrieved value (if it exists) to the given datatype. Default
          is ``str``.
  
      Returns
      -------
      val : None or str
          If the argument is present, the value. Otherwise, None.