def predict(input_data, model, columns, indices):
    """
    Predicts and returns the label.
    :param input_data: Input dictionary of input variables.
    :param model: Python dictionary model of our decision tree.
    :param columns: list of name of column fields
    :param indices: dictionary having information about indices of categorical and numeric variable
    :return: Predicted label.
    """

    if type(model) != dict:
        return model

    indicator = list(set(input_data.keys()) & set(model.keys()))

    # Using default value if nan(not a number) i.e missing value is encountered.
    if str(input_data[indicator[0]]) == 'nan':
        input_data[indicator[0]] = model[indicator[0]]['default']

    if indicator[0] in [columns[i] for i in indices['categorical']]:

        # if the indicator is categorical just do dictionary lookup

        # if the label we gave as input is not there in the model we created, take the 'default' value
        if input_data[indicator[0]] not in model[indicator[0]].keys():
            input_data[indicator[0]] = model[indicator[0]]['default']

        return predict(input_data, model[indicator[0]][input_data[indicator[0]]], columns, indices)
    else:

        # if the indicator is numeric, get the comparator and do dictionary lookup in the appropriate format
        # loop for the dict_keys until it doesn't take 'default' value
        dict_keys = iter(model[indicator[0]].keys())
        comparator = next(dict_keys)
        while comparator == 'default':
            comparator = next(dict_keys)
        comparator = float(comparator[2:])

        # if the type is str, the value should have come as the replacement of missing data so let's convert it
        # into numeric form first depending on if it is greater or smaller
        if type(input_data[indicator[0]]) == str:
            if '>' in input_data[indicator[0]]:
                input_data[indicator[0]] = float(input_data[indicator[0]][2:]) + 1
            else:
                input_data[indicator[0]] = float(input_data[indicator[0]][2:]) - 1

        if input_data[indicator[0]] >= comparator:
            return predict(input_data, model[indicator[0]]['>=' + str(comparator)], columns, indices)
        else:
            return predict(input_data, model[indicator[0]]['< ' + str(comparator)], columns, indices)