<SYSTEM_TASK:>
Solve the following problem using Python, implementing the functions described below, one line at a time
<END_TASK>
<USER_TASK:>
Description:
 def display_repository(self, namespaces=None, dest=None, summary=False, output_format='mof'):
 """ Display the namespaces and objects in the mock repository in one of multiple formats to a destination. Parameters: namespaces (:term:`string` or list of :term:`string`):
 Limits display output to the specified CIM namespace or namespaces. If `None`, all namespaces of the mock repository are displayed. dest (:term:`string`):
 File path of the output file. If `None`, the output is written to stdout. summary (:class:`py:bool`):
 Flag for summary mode. If `True`, only a summary count of CIM objects in the specified namespaces of the mock repository is produced. If `False`, both the summary count and the details of the CIM objects are produced. output_format (:term:`string`):
 Output format, one of: 'mof', 'xml', or 'repr'. """

        if output_format == 'mof':
            cmt_begin = '# '
            cmt_end = ''
        elif output_format == 'xml':
            cmt_begin = '<!-- '
            cmt_end = ' ->'
        else:
            cmt_begin = ''
            cmt_end = ''
        if output_format not in OUTPUT_FORMATS:
            raise ValueError(
                _format("Invalid output format definition {0!A}. "
                        "{1!A} are valid.", output_format, OUTPUT_FORMATS))

        _uprint(dest,
                _format(u"{0}========Mock Repo Display fmt={1} "
                        u"namespaces={2} ========={3}\n",
                        cmt_begin, output_format,
                        ('all' if namespaces is None
                         else _format("{0!A}", namespaces)),
                        cmt_end))

        # get all namespaces
        repo_ns_set = set(self.namespaces.keys())

        if namespaces:
            if isinstance(namespaces, six.string_types):
                namespaces = [namespaces]

            repo_ns_set = repo_ns_set.intersection(set(namespaces))
        repo_ns_list = sorted(list(repo_ns_set))

        for ns in repo_ns_list:
            _uprint(dest,
                    _format(u"\n{0}NAMESPACE {1!A}{2}\n",
                            cmt_begin, ns, cmt_end))
            self._display_objects('Qualifier Declarations', self.qualifiers,
                                  ns, cmt_begin, cmt_end, dest=dest,
                                  summary=summary, output_format=output_format)
            self._display_objects('Classes', self.classes, ns, cmt_begin,
                                  cmt_end, dest=dest,
                                  summary=summary, output_format=output_format)
            self._display_objects('Instances', self.instances, ns,
                                  cmt_begin, cmt_end, dest=dest,
                                  summary=summary, output_format=output_format)
            self._display_objects('Methods', self.methods, ns,
                                  cmt_begin, cmt_end, dest=dest,
                                  summary=summary, output_format=output_format)

        _uprint(dest, u'============End Repository=================')