code: def get_cur_file_size(fp, position_to_eof=False):
      
      if not position_to_eof:
          cur_pos = fp.tell()
      fp.seek(0, os.SEEK_END)
      cur_file_size = fp.tell()
      if not position_to_eof:
          fp.seek(cur_pos, os.SEEK_SET)
      return cur_file_size
docs: Returns size of file, optionally leaving fp positioned at EOF.