def _check_relevant_pbos(self, out_stream=sys.stdout):
        """ Warn if any pass_by_object variables are in any relevant set if
        top driver requires derivatives."""

        # Only warn if we are taking gradients across model with a pbo
        # variable.
        if self.driver.__class__ is Driver or \
           self.driver.supports['gradients'] is False or \
           self.root.fd_options['force_fd']:
            return []

        vec = self.root.unknowns
        pbos = [var for var in vec if vec.metadata(var).get('pass_by_obj')]

        rels = set()
        for key, rel in iteritems(self._probdata.relevance.relevant):
            rels.update(rel)

        rel_pbos = rels.intersection(pbos)
        if rel_pbos:
            rel_conns = []

            for src in rel_pbos:
                # Find target(s) and print whole relevant connection
                for tgt, src_tuple in iteritems(self.root.connections):
                    if src_tuple[0] == src and tgt in rels:
                        rel_conns.append((src, tgt))

            if rel_conns:
                print("\nThe following relevant connections are marked as pass_by_obj:",
                      file=out_stream)
                for src, tgt in rel_conns:
                    val = vec[src]
                    print("%s -> %s: type %s" % (src, tgt, type(val).__name__),
                          file=out_stream)
            else:
                print("\nThe following pass_by_obj variables are relevant to "
                      "a derivative calculation:", sorted(rel_pbos))

            print("\nYour driver requires a gradient across a model with pass_by_obj "
                  "connections. We strongly recommend either setting the root "
                  "fd_options 'force_fd' to True, or isolating the pass_by_obj "
                  "connection into a Group and setting its fd_options 'force_fd' "
                  "to True.",
                  file=out_stream)

        return list(rel_pbos)
dataset/ETHPy150Open OpenMDAO/OpenMDAO/openmdao/core/problem.py/Problem._check_relevant_pbos/original