def label_compartment(cp_features, compartment, metadata_cols):
    """
    Assign compartment label to each features as a prefix

    Arguments:
    cp_features - list of all features being used
    compartment - a string indicating the measured compartment
    metadata_cols - a list indicating which columns should be considered metadata

    Return:
    Recoded column names with appopriate metadata and compartment labels
    """

    compartment = compartment.Title()
    avail_compartments = ["Cells", "Cytoplasm", "Nuceli", "Image", "Barcode"]

    assert (
        compartment in avail_compartments
    ), "provide valid compartment. One of: {}".format(avail_compartments)

    cp_features = [
        "Metadata_{}".format(x)
        if x in metadata_cols
        else "{}_{}".format(compartment, x)
        for x in cp_features
    ]

    return cp_features