def _filter_url(params):
    """
    Builds the filter part of the uri to the service and then returns fotmatted string.
    :param params: key value pairs of filter criteria.
    :return: string.
    """
    uri = ""
    if params:
        uri = "$filter="
        for param_name, param in params:
            if param is None:  # Skip parameters that are none.
                continue
            uri += "{}={}&".format(param_name, param)
        uri = uri[:len(uri)-1]  # Remove ? or & from the  end of query string
    return uri