code: def remove_files_in_dir(dpath, fname_pattern_list='*', recursive=False,
                          verbose=VERBOSE, dryrun=False, ignore_errors=False):
      if isinstance(fname_pattern_list, six.string_types):
          fname_pattern_list = [fname_pattern_list]
      if verbose > 2:
          print('[util_path] Removing files:')
          print('  * from dpath = %r ' % dpath)
          print('  * with patterns = %r' % fname_pattern_list)
          print('  * recursive = %r' % recursive)
      num_removed, num_matched = (0, 0)
      if not exists(dpath):
          msg = ('!!! dir = %r does not exist!' % dpath)
          if verbose:
              print(msg)
          warnings.warn(msg, category=UserWarning)
      for root, dname_list, fname_list in os.walk(dpath):
          for fname_pattern in fname_pattern_list:
              for fname in fnmatch.filter(fname_list, fname_pattern):
                  num_matched += 1
                  num_removed += remove_file(join(root, fname),
                                             ignore_errors=ignore_errors,
                                             dryrun=dryrun,
                                             verbose=verbose > 5)
          if not recursive:
              break
      if verbose > 0:
          print('[util_path] ... Removed %d/%d files' % (num_removed, num_matched))
      return True