code: def __validate_required_fields(self, document):
          
          try:
              required = set(field for field, definition in self.schema.items()
                             if self._resolve_rules_set(definition).
                             get('required') is True)
          except AttributeError:
              if self.is_child and self.schema_path[-1] == 'schema':
                  raise _SchemaRuleTypeError
              else:
                  raise
          required -= self._unrequired_by_excludes
          missing = required - set(field for field in document
                                   if document.get(field) is not None or
                                   not self.ignore_none_values)
  
          for field in missing:
              self._error(field, errors.REQUIRED_FIELD)
  
          # At least on field from self._unrequired_by_excludes should be
          # present in document
          if self._unrequired_by_excludes:
              fields = set(field for field in document
                           if document.get(field) is not None)
              if self._unrequired_by_excludes.isdisjoint(fields):
                  for field in self._unrequired_by_excludes - fields:
                      self._error(field, errors.REQUIRED_FIELD)
docs: Validates that required fields are not missing.
  
          :param document: The document being validated.