input: Write a function to categorize a dataset of records using a machine learning algorithm in Python. The function should take a list of records, each with a 'label' and 'features' attribute, and return the predicted label for a given set of feature values.
  assert categorize_records([
    {"label": "apple", "features": [1, 1, 0]}, 
    {"label": "banana", "features": [0, 1, 1]}, 
    {"label": "lemon", "features": [0, 0, 1]}, 
    {"label": "orange", "features": [1, 0, 0]}, 
    {"label": "pear", "features": [0, 1, 0]}, 
  ], [1, 0, 1])=='banana'
output: def categorize_records(records, features):
      from sklearn.neighbors import KNeighborsClassifier
      X = [record['features'] for record in records]
      y = [record['label'] for record in records]
      knn = KNeighborsClassifier(n_neighbors=1)
      knn.fit(X, y)
      return knn.predict([features])[0]