def check_for_required_columns(problems, table, df):
    """
    Check that the given ProtoFeed table has the required columns.

    Parameters
    ----------
    problems : list
        A four-tuple containing

        1. A problem type (string) equal to ``'error'`` or ``'warning'``;
           ``'error'`` means the ProtoFeed is violated;
           ``'warning'`` means there is a problem but it is not a
           ProtoFeed violation
        2. A message (string) that describes the problem
        3. A ProtoFeed table name, e.g. ``'meta'``, in which the problem
           occurs
        4. A list of rows (integers) of the table's DataFrame where the
           problem occurs

    table : string
        Name of a ProtoFeed table
    df : DataFrame
        The ProtoFeed table corresponding to ``table``

    Returns
    -------
    list
        The ``problems`` list extended as follows.
        Check that the DataFrame contains the colums required by
        the ProtoFeed spec
        and append to the problems list one error for each column
        missing.

    """
    r = cs.PROTOFEED_REF
    req_columns = r.loc[(r['table'] == table) & r['column_required'],
      'column'].values
    for col in req_columns:
        if col not in df.columns:
            problems.append(['error', 'Missing column {!s}'.format(col),
              table, []])

    return problems