code: def has_attribute(self, attr):
          
          if not hasattr(self._subject, attr):
              raise self._error_factory(_format("Expected {} to have attribute {}", self._subject, attr))
          return ReferenceInspector(getattr(self._subject, attr))
docs: Ensures :attr:`subject` has an attribute *attr*.