def UpdateOne(filter, update, collection):
  """Updates a single document.
  
  Args:
    filter: A dict with filter parameters for MongoDB
    update: The update key-value pairs.
    collection: A MongoDB collection.
    
  Returns:
    Whether a document was updated.

  Raises:
    LookupError: More than one document matched the filter.
  """
  count = collection.count_documents(filter, limit=2)
  if count > 1:
    raise LookupError("More than one document found")
  collection.update_one(filter, {"$set": update})
  return count == 1