<SYSTEM_TASK:>
Solve the following problem using Python, implementing the functions described below, one line at a time
<END_TASK>
<USER_TASK:>
Description:
 def remove(self, resource, lookup=None, parent=None, **kwargs):
 """Remove docs for resource. :param resource: resource name :param lookup: filter :param parent: parent id """

        kwargs.update(self._es_args(resource))
        if parent:
            kwargs['parent'] = parent

        if lookup:
            if lookup.get('_id'):
                try:
                    return self.elastic(resource).delete(id=lookup.get('_id'), refresh=True, **kwargs)
                except elasticsearch.NotFoundError:
                    return
        return ValueError('there must be `lookup._id` specified')