Prepare various input types for CSV parsing.

    Args:
        data (iter): Data to read
        field_names (tuple of str): Ordered names to assign to fields

    Returns:
        csv.DictReader: CSV reader suitable for parsing

    Raises:
        TypeError: Invalid value for data

def prepare_csv_read(data, field_names, *args, **kwargs):
    """Prepare various input types for CSV parsing.

    Args:
        data (iter): Data to read
        field_names (tuple of str): Ordered names to assign to fields

    Returns:
        csv.DictReader: CSV reader suitable for parsing

    Raises:
        TypeError: Invalid value for data
    """
    if hasattr(data, 'readlines') or isinstance(data, list):
        pass
    elif isinstance(data, basestring):
        data = open(data)
    else:
        raise TypeError('Unable to handle data of type %r' % type(data))
    return csv.DictReader(data, field_names, *args, **kwargs)