input: Write a function to implement a basic machine learning model in Python that performs binary classification on the given data. The function should train a logistic regression model on the provided features and labels, then calculate and return the accuracy of the model on the training data. If the input data is empty, the function should return 0.
  assert binary_classification([[0.3, 0.2, 0.6], [0.3, 0.1, 0.4], [0.2, 0.3, 0.4], [0.7, 0.4, 0.2], [0.5, 0.2, 0.1]], [1, 0, 0, 1, 0])==1.0
  assert binary_classification([], [])==0
  assert binary_classification([[0.1, 0.2, 0.3], [0.4, 0.5, 0.6]], [1, 0])==0.5
output: def binary_classification(features, labels):
      if not features:
          return 0
      model = LogisticRegression()
      model.fit(features, labels)
      predictions = model.predict(features)
      accuracy = sum(predictions == labels) / len(labels)
      return accuracy