def _get_open_file(filepath, extension):
    """
    Get the appropriate writing mode regarding the provided extension
    """
    if extension == 'csv':
        return open(filepath, 'w', newline='')
    else:
        return open(filepath, 'wb')
