def pick( d, keys, include_blanks=True ):
    """
    Get the attributes named in keys from dict d. If include_blanks, include
    attributes missing from d with an empty string as the value.
    """
    if not keys:
        return d
    returned = {}
    for key in keys:
        if key in d:
            returned[ key ] = d[ key ]
        elif include_blanks:
            returned[ key ] = ''
    return returned