def prepare_metadata(metadata):
    """prepare a key/value list of metadata for the request. The metadata
       object that comes in is only parsed one level.
    """
    pairs = {'metadata': {'items': [{'key': 'client', 'value': 'sregistry'}]}}
    for key, val in metadata.items():
        if not isinstance(val, dict) and not isinstance(val, list):
            pairs['metadata']['items'].append({'key': key, 'value': val})
        elif isinstance(val, dict):
            for k, v in val.items():
                if not isinstance(v, dict) and not isinstance(v, list):
                    pairs['metadata']['items'].append({'key': k, 'value': v})
    return pairs
