Gets a list of ``Repositories`` matching the given repository query.

        arg:    repository_query (osid.repository.RepositoryQuery): the
                repository query
        return: (osid.repository.RepositoryList) - the returned
                ``RepositoryList``
        raise:  NullArgument - ``repository_query`` is ``null``
        raise:  OperationFailed - unable to complete request
        raise:  PermissionDenied - authorization failure
        raise:  Unsupported - ``repository_query`` is not of this
                service
        *compliance: mandatory -- This method must be implemented.*

def get_repositories_by_query(self, repository_query):
        """Gets a list of ``Repositories`` matching the given repository query.

        arg:    repository_query (osid.repository.RepositoryQuery): the
                repository query
        return: (osid.repository.RepositoryList) - the returned
                ``RepositoryList``
        raise:  NullArgument - ``repository_query`` is ``null``
        raise:  OperationFailed - unable to complete request
        raise:  PermissionDenied - authorization failure
        raise:  Unsupported - ``repository_query`` is not of this
                service
        *compliance: mandatory -- This method must be implemented.*

        """
        # Implemented from template for
        # osid.resource.BinQuerySession.get_bins_by_query_template
        if self._catalog_session is not None:
            return self._catalog_session.get_catalogs_by_query(repository_query)
        query_terms = dict(repository_query._query_terms)
        collection = JSONClientValidated('repository',
                                         collection='Repository',
                                         runtime=self._runtime)
        result = collection.find(query_terms).sort('_id', DESCENDING)

        return objects.RepositoryList(result, runtime=self._runtime)