Sets the Proxy's Writer by string, config object or Writer instance

@param {String/Object/Ext.data.writer.Writer} writer The new Writer, which can be either a type string,
a configuration object or an Ext.data.writer.Writer instance
@return {Ext.data.writer.Writer} The attached Writer object
function(writer) {
        var me = this,
            needsCopy = true;
            
        if (writer === undefined || typeof writer == 'string') {
            writer = {
                type: writer
            };
            needsCopy = false;
        }

        if (!writer.isWriter) {
            if (needsCopy) {
                writer = Ext.apply({}, writer);
            }
            Ext.applyIf(writer, {
                model: me.model,
                type : me.defaultWriterType
            });

            writer = Ext.createByAlias('writer.' + writer.type, writer);
        }

        me.writer = writer;

        return me.writer;
    }