def write_recurrent_layer(model_name='sas', layer_name='recurrent',
    activation='tanh', src_layer='none', rnn_type='rnn', seq_output=
    'samelength', direction='forward', rnn_size=1, dropout=0.0):
    """
    Generate Python code defining a SAS deep learning recurrent layer

    Parameters
    ----------
    model_name : string, optional
        Name for deep learning model
    layer_name : string, optional
        Layer name
    activation : string, optional
        activation function
    src_layer : string, optional
        source layer(s) for the concat layer
    rnn_type : string, optional
        one of 'rnn', 'lstm', or 'gru'
    seq_output : string, optional
        one of 'samelength' or 'encoding'
    direction : boolean, optional
        indicates whether sequence processing 
        performed in forward or reverse direction
    rnn_size : integer
        size of hidden dimension
    dropout : float, optional
        dropout rate, values range from 0.0 to 1.0

    Returns
    -------
    string

    """
    out = ['   s.addLayer(model=' + repr(model_name) + ', name=' + repr(
        layer_name) + ',', '              layer=dict(type="recurrent", n=' +
        str(rnn_size) + ',', '                         rnnType="' +
        rnn_type + '", act=' + repr(activation) + ', dropout=' + str(
        dropout) + ',', '                         outputType = "' +
        seq_output + '", reversed=' + repr(direction) + '),', 
        '              srcLayers=' + src_layer + ')']
    return '\n'.join(out)
