def invoke_main(src_vendor, name_date_re, extract_fn, default_params = {}):
  """Grab the files.

  src_vendor is a string, currently either Adobe or Monotype.
  name_date_re is a regex, it should extract name, year, month, and day fields from the filename
  extract_fn is a fn to to extract a file, it takes two args, a dest dir and the zip file name.

  default_params are default values for argparse.  They can be:
  - default_srcdir
  - default_dstdir
  - default_regex

  The default regex and the name_date_re are superficially similar, but different in
  purpose.  The default_regex is used to select files under the src directory. The
  name_date_re is used to extract the date from the file name.  Both apply to the
  file name, but the default_regex can be anything, while name_date_re needs to select
  four groups, where the 2nd, 3rd, and 4th are the year, month, and day (yes this is
  brittle, but all of this is).

  The dest directory must exist and should have 'zips' and 'drops' subdirs."""

  if not src_vendor:
    print 'must define src_vendor'
    return
  if not name_date_re:
    print 'must define name_date_re'
    return
  if not extract_fn:
    print 'must define extract_fn'
    return

  default_srcdir = default_params.get('default_srcdir')
  default_dstdir = default_params.get('default_dstdir')
  default_regex = default_params.get('default_regex')

  parser = argparse.ArgumentParser(description='Copy and extract drop from %s.' %
                                   src_vendor)
  parser.add_argument('-dd', '--dstdir', help='destination directory (default %s)' %
                      default_dstdir, default=default_dstdir, metavar='dst')
  parser.add_argument('-sd', '--srcdir', help='source directory (default %s)' %
                      default_srcdir, default=default_srcdir, metavar='src')
  parser.add_argument('--name', help='file name regex to match (default \'%s\')' %
                      default_regex, default=default_regex, metavar='re')
  parser.add_argument('--srcs', help='source files (if defined, use instead of srcdir+name)',
                      nargs="*", metavar='zip')
  args = parser.parse_args()

  if not os.path.exists(args.dstdir):
    print args.dstdir % '%s does not exists or is not a directory'
    return

  if not args.srcs:
    if not os.path.isdir(args.srcdir):
      print '%s does not exist or is not a directory' % args.srcdir
      return
    filelist = matching_files_in_dir(args.srcdir, args.name)
  else:
    filelist = args.srcs

  grab_files(args.dstdir, filelist, src_vendor, name_date_re, extract_fn)
dataset/ETHPy150Open googlei18n/nototools/nototools/grab_download.py/invoke_main/swapped operands of `%`