<SYSTEM_TASK:>
Solve the following problem using Python, implementing the functions described below, one line at a time
<END_TASK>
<USER_TASK:>
Description:
 def query_citations(self, type: Optional[str] = None, reference: Optional[str] = None, name: Optional[str] = None, author: Union[None, str, List[str]] = None, date: Union[None, str, datetime.date] = None, evidence_text: Optional[str] = None, ) -> List[Citation]: """Query citations in the database. :param type: Type of the citation. e.g. PubMed :param reference: The identifier used for the citation. e.g. PubMed_ID :param name: Title of the citation. :param author: The name or a list of names of authors participated in the citation. :param date: Publishing date of the citation. :param evidence_text: """

        query = self.session.query(Citation)

        if author is not None:
            query = query.join(Author, Citation.authors)
            if isinstance(author, str):
                query = query.filter(Author.name.like(author))
            elif isinstance(author, Iterable):
                query = query.filter(Author.has_name_in(set(author)))
            else:
                raise TypeError

        if type and not reference:
            query = query.filter(Citation.type.like(type))
        elif reference and type:
            query = query.filter(Citation.reference == reference)
        elif reference and not type:
            raise ValueError('reference specified without type')

        if name:
            query = query.filter(Citation.name.like(name))

        if date:
            if isinstance(date, datetime.date):
                query = query.filter(Citation.date == date)
            elif isinstance(date, str):
                query = query.filter(Citation.date == parse_datetime(date))

        if evidence_text:
            query = query.join(Evidence).filter(Evidence.text.like(evidence_text))

        return query.all()