def METHOD_NAME(csv_file, out_file=None):
    """
    Put subject, session and scan in front of csv file
    :param str csv_file: the input csv file
    :param str out_file: if provided, a new csv file is created
    :return: the path to the file with the columns reordered
    """
    if isinstance(csv_file, list):
        csv_file = csv_file[-1]
    if out_file is None:
        out_file = csv_file
    dataframe = pd.read_csv(csv_file)
    cols = dataframe.columns.tolist()  # pylint: disable=no-member
    try:
        cols.remove("Unnamed: 0")
    except ValueError:
        # The column does not exist
        pass
    for col in ["scan", "session", "subject"]:
        cols.remove(col)
        cols.insert(0, col)
    dataframe[cols].to_csv(out_file)
    return out_file