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