code: def _get_uploaded_file(session, file_info, fragment_count=0):
          
          try:
              return session.query(UploadedFile).filter(UploadedFile.sha1 == file_info.sha1).one()
          except NoResultFound:
              new_instance = UploadedFile(
                  sha1=file_info.sha1,
                  file_name=file_info.upath,
                  fragment_count=fragment_count
              )
              session.add(new_instance)
              return new_instance
docs: :param session: locked session (with self._session_resource as >> session <<)
          :param file_info: contains file information to save or query
          :param fragment_count: amount of fragments associated to the file
          :return: an UploadedFile associated to the file_info