code: def compile(definition, handlers={}):
      
      resolver, code_generator = _factory(definition, handlers)
      global_state = code_generator.global_state
      # Do not pass local state so it can recursively call itself.
      exec(code_generator.func_code, global_state)
      return global_state[resolver.get_scope_name()]
docs: Generates validation function for validating JSON schema passed in ``definition``.
      Example:
  
      .. code-block:: python
  
          import fastjsonschema
  
          validate = fastjsonschema.compile({'type': 'string'})
          validate('hello')
  
      This implementation support keyword ``default``:
  
      .. code-block:: python
  
          validate = fastjsonschema.compile({
              'type': 'object',
              'properties': {
                  'a': {'type': 'number', 'default': 42},
              },
          })
  
          data = validate({})
          assert data == {'a': 42}
  
      Supported implementations are draft-04, draft-06 and draft-07. Which version
      should be used is determined by `$draft` in your ``definition``. When not
      specified, the latest implementation is used (draft-07).
  
      .. code-block:: python
  
          validate = fastjsonschema.compile({
              '$schema': 'http://json-schema.org/draft-04/schema',
              'type': 'number',
          })
  
      You can pass mapping from URI to function that should be used to retrieve
      remote schemes used in your ``definition`` in parameter ``handlers``.
  
      Exception :any:`JsonSchemaDefinitionException` is raised when generating the
      code fails (bad definition).
  
      Exception :any:`JsonSchemaException` is raised from generated funtion when
      validation fails (data do not follow the definition).