def project(atts, row, renaming={}):
    """Create a new dictionary with a subset of the attributes.

       Arguments:
       - atts is a sequence of attributes in row that should be copied to the
         new result row.
       - row is the original dictionary to copy data from.
       - renaming is a mapping of names such that for each k in atts,
         the following holds:

         - If k in renaming then result[k] = row[renaming[k]].
         - If k not in renaming then result[k] = row[k].
         - renaming defaults to {}
    """
    res = {}
    for c in atts:
        if c in renaming:
            res[c] = row[renaming[c]]
        else:
            res[c] = row[c]
    return res