<SYSTEM_TASK:>
Solve the following problem using Python, implementing the functions described below, one line at a time
<END_TASK>
<USER_TASK:>
Description:
 def validate_stream(stream):
 """ Check that the stream name is well-formed. """

  if not STREAM_REGEX.match(stream) or len(stream) > MAX_STREAM_LENGTH:
    raise InvalidStreamName(stream)