def length(b):
  """
    Returns the length of the first netstring in the provided bytes object without decoding it.
    WARNING: This function doesn't check for netstring validity.
  """
  try:
    return int(b[:b.find(b':')].decode('ascii'))
  except:
    raise ValueError