def ParentId(tpe, id):
    """
    A criterion used to search for records by their parent's id. For example
    
    * search for observables by case id
    * search for tasks by case id
    * search for logs by task id
    * search for jobs by observable id

    Arguments:
        tpe (str): class name of the parent: `case`, `case_task`, `case_artifact`...
        id (str): the parent id's value

    Returns:
        dict: JSON repsentation of the criterion
            ```python
            # Query to search for tasks of a case by id
            query = ParentId('case', '1234545643')
            ```
            produces
            ```json
            {
                "_parent": {
                    "_type": "case",
                    "_id": "1234545643"
                }
            }
            ```
    """
    return {'_parent': {'_type': tpe, '_id': id}}