def gen_attributes(rp_attributes):
    "Generate list of attributes for the API request.\n\n    Example of input list:\n    ['tag_name:tag_value1', 'tag_value2']\n    Output of the function for the given input list:\n    [{'key': 'tag_name', 'value': 'tag_value1'}, {'value': 'tag_value2'}]\n\n    :param rp_attributes: List of attributes(tags)\n    :return:              Correctly created list of dictionaries\n                          to be passed to RP\n    "
    attrs = []
    for rp_attr in rp_attributes:
        try:
            (key, value) = rp_attr.split(':')
            attr_dict = {'key': key, 'value': value}
        except ValueError as exc:
            logger.debug(str(exc))
            attr_dict = {'value': rp_attr}
        if all(attr_dict.values()):
            attrs.append(attr_dict)
            continue
        logger.debug('Failed to process "{0}" attribute, attribute value should not be empty.'.format(rp_attr))
    return attrs
Generate list of attributes for the API request.

Example of input list:
['tag_name:tag_value1', 'tag_value2']
Output of the function for the given input list:
[{'key': 'tag_name', 'value': 'tag_value1'}, {'value': 'tag_value2'}]

:param rp_attributes: List of attributes(tags)
:return:              Correctly created list of dictionaries
                      to be passed to RP
def gen_attributes(rp_attributes):
    "Generate list of attributes for the API request.\n\n    Example of input list:\n    ['tag_name:tag_value1', 'tag_value2']\n    Output of the function for the given input list:\n    [{'key': 'tag_name', 'value': 'tag_value1'}, {'value': 'tag_value2'}]\n\n    :param rp_attributes: List of attributes(tags)\n    :return:              Correctly created list of dictionaries\n                          to be passed to RP\n    "
    attrs = []
    for rp_attr in rp_attributes:
        try:
            (key, value) = rp_attr.split(':')
            attr_dict = {'key': key, 'value': value}
        except ValueError as exc:
            logger.debug(str(exc))
            attr_dict = {'value': rp_attr}
        if all(attr_dict.values()):
            attrs.append(attr_dict)
            continue
        logger.debug('Failed to process "{0}" attribute, attribute value should not be empty.'.format(rp_attr))
    return attrs