code: def generate_ref(self):
          
          with self._resolver.in_scope(self._definition['$ref']):
              name = self._resolver.get_scope_name()
              uri = self._resolver.get_uri()
              if uri not in self._validation_functions_done:
                  self._needed_validation_functions[uri] = name
              # call validation function
              self.l('{}({variable})', name)
docs: Ref can be link to remote or local definition.
  
          .. code-block:: python
  
              {'$ref': 'http://json-schema.org/draft-04/schema#'}
              {
                  'properties': {
                      'foo': {'type': 'integer'},
                      'bar': {'$ref': '#/properties/foo'}
                  }
              }