def _normalize(schema, allow_none=True):
if allow_none and schema is None:<EOL><INDENT>return schema<EOL><DEDENT>if isinstance(schema, CommonSchema):<EOL><INDENT>return schema<EOL><DEDENT>if isinstance(schema, StreamSchema):<EOL><INDENT>return schema<EOL><DEDENT>if isinstance(schema, basestring):<EOL><INDENT>return StreamSchema(schema)<EOL><DEDENT>py_types = {<EOL>_spl_object: CommonSchema.Python,<EOL>_spl_str: CommonSchema.String,<EOL>json: CommonSchema.Json,<EOL>}<EOL>if schema in py_types:<EOL><INDENT>return py_types[schema]<EOL><DEDENT>if sys.version_info.major == <NUM_LIT:3>:<EOL><INDENT>import typing<EOL>if isinstance(schema, type) and  issubclass(schema, tuple):<EOL><INDENT>if hasattr(schema, '<STR_LIT>') and hasattr(schema, '<STR_LIT>'):<EOL><INDENT>return _from_named_tuple(schema)<EOL><DEDENT><DEDENT><DEDENT>raise ValueError("<STR_LIT>" + str(schema))<EOL>
Normalize a schema.