Transforms dictionary into pipeline object properties.

    The output format conforms to boto's specification.

    Example input:
        {
            'a': '1',
            'b': {
                'ref': '2'
            },
        }

    Example output:
        [
            {
                'key': 'a',
                'stringValue': '1',
            },
            {
                'key': 'b',
                'refValue': '2',
            },
        ]

def _properties_from_dict(d, key_name='key'):
    '''
    Transforms dictionary into pipeline object properties.

    The output format conforms to boto's specification.

    Example input:
        {
            'a': '1',
            'b': {
                'ref': '2'
            },
        }

    Example output:
        [
            {
                'key': 'a',
                'stringValue': '1',
            },
            {
                'key': 'b',
                'refValue': '2',
            },
        ]
    '''
    fields = []
    for key, value in six.iteritems(d):
        if isinstance(value, dict):
            fields.append({
                key_name: key,
                'refValue': value['ref'],
            })
        else:
            fields.append({
                key_name: key,
                'stringValue': value,
            })
    return fields