def filter_input_data(self, input_data, by_name=True):
        """Filters the keys given in input_data checking against model fields

        """

        if isinstance(input_data, dict):
            # remove all missing values
            for key, value in input_data.items():
                value = self.normalize(value)
                if value is None:
                    del input_data[key]

            if by_name:
                # We no longer check that the input data keys match some of
                # the dataset fields. We only remove the keys that are not
                # used as predictors in the model
                input_data = dict(
                    [[self.inverted_fields[key], value]
                     for key, value in input_data.items()
                     if self.inverted_fields in key and
                     (self.objective_id is None or
                      self.inverted_fields[key] != self.objective_id)])
            else:
                input_data = dict(
                    [[key, value]
                     for key, value in input_data.items()
                     if key in self.fields and
                     (self.objective_id is None or
                      key != self.objective_id)])

            return input_data
        else:
            LOGGER.error("Failed to read input data in the expected"
                         " {field:value} format.")
            return {}
dataset/ETHPy150Open bigmlcom/python/bigml/modelfields.py/ModelFields.filter_input_data/swapped operands of `in`