code: def UrnStringToHuntId(urn):
    
    if urn.startswith(AFF4_PREFIX):
      urn = urn[len(AFF4_PREFIX):]
  
    components = urn.split("/")
    if len(components) != 2 or components[0] != "hunts":
      raise ValueError("Invalid hunt URN: %s" % urn)
  
    return components[-1]
docs: Converts given URN string to a flow id string.