<SYSTEM_TASK:>
Solve the following problem using Python, implementing the functions described below, one line at a time
<END_TASK>
<USER_TASK:>
Description:
 def triples(self, (s, p, o), context=None):
 """ Returns all triples in the current store. """

        named_graph = _get_named_graph(context)
        query_sets = _get_query_sets_for_object(o)

        filter_parameters = dict()
        if named_graph is not None:
            filter_parameters['context_id'] = named_graph.id
        if s:
            filter_parameters['subject'] = s
        if p:
            filter_parameters['predicate'] = p
        if o:
            filter_parameters['object'] = o

        query_sets = [qs.filter(**filter_parameters) for qs in query_sets]  # pylint: disable=W0142

        for qs in query_sets:
            for statement in qs:
                triple = statement.as_triple()
                yield triple, context