code: def wc(f, verbose=False, nrows=None):
      r
      tqdm_prog = tqdm if verbose else no_tqdm
      with ensure_open(f, mode='r') as fin:
          for i, line in tqdm_prog(enumerate(fin)):
              if nrows is not None and i >= nrows - 1:
                  break
          # fin.seek(0)
          return i + 1
docs: r""" Count lines in a text file
  
      References:
          https://stackoverflow.com/q/845058/623735
  
      >>> with open(os.path.join(DATA_PATH, 'dictionary_fda_drug_names.txt')) as fin:
      ...     print(wc(fin) == wc(fin) == 7037 == wc(fin.name))
      True
      >>> wc(fin.name)
      7037