input: Write a function to implement a basic machine learning model in Python that performs binary classification on the given data. The function should fit a logistic regression model to the input data and calculate the accuracy of the model.
  
  def binary_classification(X, y):
      from sklearn import linear_model
      from sklearn.metrics import accuracy_score
  
      model = linear_model.LogisticRegression()
      model.fit(X, y)
  
      y_pred = model.predict(X)
      accuracy = accuracy_score(y, y_pred)
  
      return accuracy
  
  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]) == 0.8
  assert binary_classification([[0.4, 0.2, 0.3], [0.2, 0.1, 0.1], [0.3, 0.2, 0.3], [0.7, 0.4, 0.2], [0.5, 0.2, 0.1]], [1, 0, 0, 1, 0]) == 1.0
  assert binary_classification([[0.1, 0.2, 0.3], [0.2, 0.3, 0.4], [0.4, 0.5, 0.6], [0.7, 0.8, 0.9], [0.1, 0.2, 0.3]], [0, 0, 1, 1, 1]) == 0.4
  assert binary_classification([], []) == 0.0
output: def binary_classification(X, y):
      from sklearn import linear_model
      from sklearn.metrics import accuracy_score
  
      if len(X) == 0 or len(y) == 0:
          return 0.0
  
      model = linear_model.LogisticRegression()
      model.fit(X, y)
  
      y_pred = model.predict(X)
      accuracy = accuracy_score(y, y_pred)
  
      return accuracy