<SYSTEM_TASK:>
Solve the following problem using Python, implementing the functions described below, one line at a time
<END_TASK>
<USER_TASK:>
Description:
 def find_aliases(self, seq_id=None, namespace=None, alias=None, current_only=True, translate_ncbi_namespace=None):
 """returns iterator over alias annotation records that match criteria The arguments, all optional, restrict the records that are returned. Without arguments, all aliases are returned. If arguments contain %, the `like` comparison operator is used. Otherwise arguments must match exactly. """

        clauses = []
        params = []

        def eq_or_like(s):
            return "like" if "%" in s else "="

        if translate_ncbi_namespace is None:
            translate_ncbi_namespace = self.translate_ncbi_namespace
        if alias is not None:
            clauses += ["alias {} ?".format(eq_or_like(alias))]
            params += [alias]
        if namespace is not None:
            # Switch to using RefSeq for RefSeq accessions
            # issue #38: translate "RefSeq" to "NCBI" to enable RefSeq lookups
            # issue #31: later breaking change, translate database
            if namespace == "RefSeq":
                namespace = "NCBI"
            clauses += ["namespace {} ?".format(eq_or_like(namespace))]
            params += [namespace]
        if seq_id is not None:
            clauses += ["seq_id {} ?".format(eq_or_like(seq_id))]
            params += [seq_id]
        if current_only:
            clauses += ["is_current = 1"]

        cols = ["seqalias_id", "seq_id", "alias", "added", "is_current"]
        if translate_ncbi_namespace:
            cols += ["case namespace when 'NCBI' then 'RefSeq' else namespace end as namespace"]
        else:
            cols += ["namespace"]
        sql = "select {cols} from seqalias".format(cols=", ".join(cols))
        if clauses:
            sql += " where " + " and ".join("(" + c + ")" for c in clauses)
        sql += " order by seq_id, namespace, alias"

        _logger.debug("Executing: " + sql)
        return self._db.execute(sql, params)