def file_writer(filename):
    """
    Open a file for writing.
  
    Args:
        filename: (string) the name of the path/file to open for writing.
    Returns:
        file object.
    Raises:
        IOError: If filename is not writeable.
    """
    try:
        fileobj = open(filename, 'w')
    except IOError as e:
        raise IOError("{0}: {1}".format(e.strerror, filename))
    return fileobj