import logging


def column_exists(df, column, log=True, stdout=True, log_msg=None):
    """Check whether a column exists in a given pandas DataFrame."""
    if column in df.columns:
        return True
    if log:
        if log_msg:
            log_msg = str(log_msg)
        else:
            log_msg = (f'WARNING: `{column}` column is not used in this DataFrame. '
                       'Processing for this column was skipped.')
        logging.warning(log_msg)
    if stdout:
        print(log_msg)
    return False