docs: def sort_and_print_entries(entries, args):
      """Sort the entries, applying the filters first if necessary."""
  
      # Extract the proper number type.
      is_float = args.number_type in ("float", "real", "f", "r")
      signed = args.signed or args.number_type in ("real", "r")
      alg = (
          natsort.ns.FLOAT * is_float
          | natsort.ns.SIGNED * signed
          | natsort.ns.NOEXP * (not args.exp)
          | natsort.ns.PATH * args.paths
          | natsort.ns.LOCALE * args.locale
      )
  
      # Pre-remove entries that don't pass the filtering criteria
      # Make sure we use the same searching algorithm for filtering
      # as for sorting.
      do_filter = args.filter is not None or args.reverse_filter is not None
      if do_filter or args.exclude:
          inp_options = (
              natsort.ns.FLOAT * is_float
              | natsort.ns.SIGNED * signed
              | natsort.ns.NOEXP * (not args.exp)
          )
          regex = regex_chooser(inp_options)
          if args.filter is not None:
              lows, highs = ([f[0] for f in args.filter], [f[1] for f in args.filter])
              entries = [
                  entry
                  for entry in entries
                  if keep_entry_range(entry, lows, highs, float, regex)
              ]
          if args.reverse_filter is not None:
              lows, highs = (
                  [f[0] for f in args.reverse_filter],
                  [f[1] for f in args.reverse_filter],
              )
              entries = [
                  entry
                  for entry in entries
                  if not keep_entry_range(entry, lows, highs, float, regex)
              ]
          if args.exclude:
              exclude = set(args.exclude)
              entries = [
                  entry
                  for entry in entries
                  if keep_entry_value(entry, exclude, float, regex)
              ]
  
      # Print off the sorted results
      for entry in natsort.natsorted(entries, reverse=args.reverse, alg=alg):
          print(entry)