from functools import reduce


def iterative_hash(s):
  """Compute the has code of the given string as in:
  net/traffic_annotation/network_traffic_annotation.h

  Args:
    s: str
      The seed, e.g. unique id of traffic annotation.
  Returns: int
    A hash code.
  """
  return reduce(lambda acc, c: (acc*31 + ord(c)) % 138003713, s, 0)