<SYSTEM_TASK:>
Solve the following problem using Python, implementing the functions described below, one line at a time
<END_TASK>
<USER_TASK:>
Description:
 def with_relations(self, user=None):
 """ Return a cleaned dictionary including relations :returns: a Repository instance """

        repository = self.clean(user=user)
        try:
            parent = yield self.get_parent()
            repository['organisation'] = parent.clean()
        except couch.NotFound:
            parent = None
            repository['organisation'] = {'id': self.parent_id}

        service_id = self.service_id
        try:
            # TODO: cache this lookup
            service = yield Service.get(service_id)
            repository['service'] = service.clean(user=user)
        except couch.NotFound:
            # just include the service ID if cannot find the service
            repository['service'] = {'id': service_id}

        del repository['service_id']
        del repository['organisation_id']

        raise Return(repository)