docs: def get_parser(config=None):
      """
      return a parser suitable to parse CL arguments.
  
      Parameters
      ----------
  
      config: dict
          Default values to fall back on, if not given.
  
      Returns
      -------
  
          An argparse parser configured to parse the command lines arguments of
          sys.argv which will default on values present in ``config``.
      """
      # This uses RawTextHelpFormatter so that the description (the docstring of
      # this module) is formatted correctly. Unfortunately, that means that
      # parser help is not text wrapped (but all other help is).
      parser = argparse.ArgumentParser(description=__doc__,
          formatter_class=argparse.RawTextHelpFormatter, epilog="""
  Run --help on the subcommands like 'doctr deploy --help' to see the
  options available.
          """,
          )
  
      if not config:
          config={}
      parser.add_argument('-V', '--version', action='version', version='doctr ' + __version__)
  
      subcommand = parser.add_subparsers(title='subcommand', dest='subcommand')
  
      deploy_parser = subcommand.add_parser('deploy', help="""Deploy the docs to GitHub from Travis.""")
      deploy_parser.set_defaults(func=deploy)
      deploy_parser_add_argument = make_parser_with_config_adder(deploy_parser, config)
      deploy_parser_add_argument('--force', action='store_true', help="""Run the deploy command even
      if we do not appear to be on Travis.""")
      deploy_parser_add_argument('deploy_directory', type=str, nargs='?',
          help="""Directory to deploy the html documentation to on gh-pages.""")
      deploy_parser_add_argument('--token', action='store_true', default=False,
          help="""Push to GitHub using a personal access token. Use this if you
          used 'doctr configure --token'.""")
      deploy_parser_add_argument('--key-path', default=None,
          help="""Path of the encrypted GitHub deploy key. The default is github_deploy_key_+
          deploy respository name + .enc.""")
      deploy_parser_add_argument('--built-docs', default=None,
          help="""Location of the built html documentation to be deployed to gh-pages. If not
          specified, Doctr will try to automatically detect build location
          (right now only works for Sphinx docs).""")
      deploy_parser.add_argument('--deploy-branch-name', default=None,
                                 help="""Name of the branch to deploy to (default: 'master' for ``*.github.io``
                                 and wiki repos, 'gh-pages' otherwise)""")
      deploy_parser_add_argument('--tmp-dir', default=None,
          help=argparse.SUPPRESS)
      deploy_parser_add_argument('--deploy-repo', default=None, help="""Repo to
          deploy the docs to. By default, it deploys to the repo Doctr is run from.""")
      deploy_parser_add_argument('--branch-whitelist', default=None, nargs='*',
          help="""Branches to deploy from. Pass no arguments to not build on any branch
          (typically used in conjunction with --build-tags). Note that you can
          deploy from every branch with --no-require-master.""", metavar="BRANCH")
      deploy_parser_add_argument('--no-require-master', dest='require_master', action='store_false',
          default=True, help="""Allow docs to be pushed from a branch other than master""")
      deploy_parser_add_argument('--command', default=None,
          help="""Command to be run before committing and pushing. This command
          will be run from the deploy repository/branch. If the command creates
          additional files that should be deployed, they should be added to the
          index.""")
      deploy_parser_add_argument('--no-sync', dest='sync', action='store_false',
          default=True, help="""Don't sync any files. This is generally used in
          conjunction with the --command flag, for instance, if the command syncs
          the files for you. Any files you wish to commit should be added to the
          index.""")
      deploy_parser.add_argument('--no-temp-dir', dest='temp_dir',
          action='store_false', default=True, help="""Don't copy the
          --built-docs directory to a temporary directory.""")
      deploy_parser_add_argument('--no-push', dest='push', action='store_false',
          default=True, help="Run all the steps except the last push step. "
          "Useful for debugging")
      deploy_parser_add_argument('--build-tags', action='store_true',
          default=False, help="""Deploy on tag builds. On a tag build,
          $TRAVIS_TAG is set to the name of the tag. The default is to not
          deploy on tag builds. Note that this will still build on a branch,
          unless --branch-whitelist (with no arguments) is passed.""")
      deploy_parser_add_argument('--gh-pages-docs', default=None,
          help="""!!DEPRECATED!! Directory to deploy the html documentation to on gh-pages.
          The default is %(default)r. The deploy directory should be passed as
          the first argument to 'doctr deploy'. This flag is kept for backwards
          compatibility.""")
      deploy_parser_add_argument('--exclude', nargs='+', default=(), help="""Files and
          directories from --built-docs that are not copied.""")
  
      if config:
          print('Warning, The following options in `.travis.yml` were not recognized:\n%s' % json.dumps(config, indent=2))
  
      configure_parser = subcommand.add_parser('configure', help="Configure doctr. This command should be run locally (not on Travis).")
      configure_parser.set_defaults(func=configure)
      configure_parser.add_argument('--force', action='store_true', help="""Run the configure command even
      if we appear to be on Travis.""")
      configure_parser.add_argument('--token', action="store_true", default=False,
          help="""Generate a personal access token to push to GitHub. The default is to use a
          deploy key. WARNING: This will grant read/write access to all the
          public repositories for the user. This option is not recommended
          unless you are using a separate GitHub user for deploying.""")
      configure_parser.add_argument("--no-upload-key", action="store_false", default=True,
          dest="upload_key", help="""Don't automatically upload the deploy key to GitHub. To prevent doctr
          configure from asking for your GitHub credentials, use
          --no-authenticate.""")
      configure_parser.add_argument("--no-authenticate", action="store_false",
          default=True, dest="authenticate", help="""Don't authenticate with GitHub. This option implies --no-upload-key. This
          option is also not compatible with private repositories.""")
      configure_parser.add_argument('--key-path', default=None,
          help="""Path to save the encrypted GitHub deploy key. The default is github_deploy_key_+
          deploy respository name. The .enc extension is added to the file automatically.""")
      configure_parser.add_argument('--travis-tld', default=None,
          help="""Travis tld to use. Should be either '.com' or '.org'. The default is to
          check which the repo is activated on and ask if it is activated on
          both.""", choices=['c', 'com', '.com', 'travis-ci.com', 'o', 'org', '.org',
                             'travis-ci.org'])
  
      return parser