input: Write a function to implement a Python script that competes in a Kaggle competition. The function should load necessary libraries, read data, split the data, define the model, make predictions, and calculate the accuracy score. If the competition involves submitting the predictions, the function should also handle that.
  assert kaggle_competition(pd.DataFrame({'response': [1, 0, 1], 'feature1': [0.5, 0.3, 0.7], 'feature2': [0.2, 0.8, 0.1]}), 'response', 'data.csv') == 1.0
  assert kaggle_competition(pd.DataFrame({'response': [1, 1, 0], 'feature1': [0.1, 0.9, 0.2], 'feature2': [0.3, 0.7, 0.5]}), 'response', 'data.csv') == 0.5
  assert kaggle_competition(pd.DataFrame({'response': [0, 1, 0], 'feature1': [0.8, 0.4, 0.6], 'feature2': [0.9, 0.2, 0.3]}), 'response', 'data.csv') == 1.0
  assert kaggle_competition(pd.DataFrame({'response': [1, 1, 1], 'feature1': [0.5, 0.3, 0.7], 'feature2': [0.2, 0.8, 0.1]}), 'response', 'data.csv') == 1.0
  assert kaggle_competition(pd.DataFrame({'response': [0, 0, 0], 'feature1': [0.1, 0.9, 0.2], 'feature2': [0.3, 0.7, 0.5]}), 'response', 'data.csv') == 0.0
output: def kaggle_competition(data, target_col, submission_file):
      from sklearn.model_selection import train_test_split
      from sklearn.linear_model import LogisticRegression
      from sklearn.metrics import accuracy_score
      import pandas as pd
      
      X = data.drop(columns=[target_col])
      y = data[target_col]
      
      X_train, X_test, y_train, y_test = train_test_split(X, y, test_size=0.2, random_state=42)
      
      model = LogisticRegression()
      model.fit(X_train, y_train)
      
      y_pred = model.predict(X_test)
      accuracy = accuracy_score(y_test, y_pred)
      
      submission = pd.DataFrame({'response': y_pred})
      submission.to_csv(submission_file, index=False)
      
      return accuracy