def fetch_metadata(self, exp_name=None, query=None, indices=None):
        """Return all metadata for matching experiment name, index or query."""
        from tinydb import Query

        if exp_name or query:
            if query:
                q = query
            elif exp_name:
                q = Query().experiment.name.search(exp_name)

            entries = self.runs.search(q)

        elif indices or indices == 0:
            if not isinstance(indices, (tuple, list)):
                indices = [indices]

            num_recs = len(self.runs)

            for idx in indices:
                if idx >= num_recs:
                    raise ValueError(
                        "Index value ({}) must be less than "
                        "number of records ({})".format(idx, num_recs)
                    )

            entries = [self.runs.all()[ind] for ind in indices]

        else:
            raise ValueError(
                "Must specify an experiment name, indicies or " "pass custom query"
            )

        return entries
Return all metadata for matching experiment name, index or query.
sacred/observers/tinydb_hashfs/tinydb_hashfs.py