code: def get_counter(counterfile):
      
      try:
          version_num = open(counterfile).read()
          version_num = int(version_num) + 1
      except (ValueError, IOError):
          version_num = 1
          create_file(counterfile, "%d" % version_num)
      except BaseException as msg:
          raise SaChannelUpdateError(msg)
      return version_num
docs: Get the counter value