def size(b):
  """
    Returns the size in bytes of the first netstring in the provided bytes object.
    WARNING: This function doesn't check for netstring validity.

    THROWS:
      ValueError if cannot determine size
  """
  try:
    slen = b[:b.find(b':')].decode('ascii')

    return 2 + len(slen) + int(slen)
  except:
    raise ValueError