def ReadTag(buf, pos):
  """Read a tag from the buffer, and return a (tag_bytes, new_pos) tuple."""
  try:
    start = pos
    while ORD_MAP_AND_0X80[buf[pos]]:
      pos += 1
    pos += 1
    return (buf[start:pos], pos)
  except __HOLE__:
    raise ValueError("Invalid tag")


# This function is HOT.
dataset/ETHPy150Open google/grr/grr/lib/rdfvalues/structs.py/ReadTag