def get_pipeline_from_database(pipeline_id, mongo_client):
    """
    This function gets a pipeline from our local database given an id

    Parameters
    ----------
    pipeline_id: the id of the pipeline to grab
    mongo_client: a connection to the database

    :return a pipeline matching the id
    """
    collection = mongo_client.metalearning.pipelines
    pipeline_to_write = collection.find({"id": pipeline_id})
    for pipeline in pipeline_to_write:
        # should only be one pipeline
        return pipeline
    raise FileExistsError("Pipeline ID does not exist in the database")