code: def validate_schema(yaml_def, branch=False):
      
      schema = Schema({
          'lane' if not branch else 'branch': {
              Optional('name'): str,
              Optional('run_parallel'): bool,
              'tasks': list
          }
      })
  
      schema.validate(yaml_def)
      from schema import And, Use
      task_schema = Schema({
          'class': str,
          Optional('kwargs'): Or({str: object}),
          Optional('args'): Or([object], And(Use(lambda a: isinstance(a, dict)), False))
      })
  
      def validate_tasks(tasks):  # pylint: disable=missing-docstring
          for task in tasks:
              try:
                  Schema({'branch': dict}).validate(task)
                  validate_schema(task, True)
              except SchemaError:
                  task_schema.validate(task)
  
          return True
  
      return validate_tasks(yaml_def['lane']['tasks'] if not branch else yaml_def['branch']['tasks'])
docs: Validates the schema of a dict
  
      Parameters
      ----------
      yaml_def : dict
          dict whose schema shall be validated
      branch : bool
          Indicates whether `yaml_def` is a dict of a top-level lane, or of a branch
          inside a lane (needed for recursion)
  
      Returns
      -------
      bool
          True if validation was successful