def fillna(df, cols=None, fill_val='__missing__'):
    """
    A wrapper for pandas fillna function
    
    Args:
        df - a pandas DataFrame
        cols - None or list of column names
               if None, fillna is called on the entire DataFrame
               if a list of columns, fillna is called only on those columns
        fill_val - a value used to fill in any NA elements
    
    Returns:
        a DataFrame with NA values replaced with fill_val
    """
    if cols is None:
        df = df.fillna(fill_val)
    else:
        df[cols] = df[cols].fillna(fill_val)
    return df