def get_cur_file_size(fp, position_to_eof=False):
 if (isinstance(fp, KeyFile) and (not position_to_eof)):
  return fp.getkey().size
 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

def get_cur_file_size ( fp , position_to_eof = False ) : if ( isinstance ( fp , KeyFile ) and ( not position_to_eof ) ) : return fp . getkey ( ) . size 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
returns size of file .