input: Write a function named `train_binary_classifier` that implements a basic machine learning model in Python to perform binary classification on the given data. The function should use a logistic regression model from `sklearn.linear_model` and calculate the accuracy using `sklearn.metrics.accuracy_score`. The function should return the accuracy of the model. If the input data is empty, the function should return 0.
  
  assert train_binary_classifier([[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]) is not None
  assert train_binary_classifier([], []) == 0
output: def train_binary_classifier(data, labels):
      if not data:
          return 0
      from sklearn.linear_model import LogisticRegression
      from sklearn.metrics import accuracy_score
      model = LogisticRegression()
      model.fit(data, labels)
      predictions = model.predict(data)
      return accuracy_score(labels, predictions)