<SYSTEM_TASK:>
Solve the following problem using Python, implementing the functions described below, one line at a time
<END_TASK>
<USER_TASK:>
Description:
 def filterTs(ts, expressions):
 """ Create a new time series that only contains entries that match the given expression. | Example: | D = lipd.loadLipd() | ts = lipd.extractTs(D) | new_ts = filterTs(ts, "archiveType == marine sediment") | new_ts = filterTs(ts, ["paleoData_variableName == sst", "archiveType == marine sediment"]) | Expressions should use underscores to denote data nesting. | Ex: paleoData_hasResolution_hasMedian or :param list OR str expressions: Expressions :param list ts: Time series :return list new_ts: Filtered time series that matches the expression """

    # Make a copy of the ts. We're going to work directly on it.
    new_ts = ts[:]

    # User provided a single query string
    if isinstance(expressions, str):
        # Use some magic to turn the given string expression into a machine-usable comparative expression.
        expr_lst = translate_expression(expressions)
        # Only proceed if the translation resulted in a usable expression.
        if expr_lst:
            # Return the new filtered time series. This will use the same time series
            # that filters down each loop.
            new_ts, _idx = get_matches(expr_lst, new_ts)

    # User provided a list of multiple queries
    elif isinstance(expressions, list):
        # Loop for each query
        for expr in expressions:
            # Use some magic to turn the given string expression into a machine-usable comparative expression.
            expr_lst = translate_expression(expr)
            # Only proceed if the translation resulted in a usable expression.
            if expr_lst:
                # Return the new filtered time series. This will use the same time series
                # that filters down each loop.
                new_ts, _idx = get_matches(expr_lst, new_ts)

    return new_ts