def parse_counts_and_flavors(counts, overcloud_roles):
    """Helper for parsing the OvercloudRoleCount object

    Given a list of OvercloudRoleCount and dict of OverlcoudRole objects
    return a dict of (image_name, count) and (image_name, flavor_id) in a
    format used for building a template.

    :param counts: List of tuskar.api.controllers.v1.models.OvercloudRoleCount
    :type  counts: list

    :param overcloud_roles: Dict of (overcloud_role_id, overcloud_role) so
                            we can access image_name and flavor_id of roles
    :type  overcloud_roles: dict

    :return: Tuple of dicts {(image_name, count)}, {(image_name, flavor_id)}
    :rtype:  two dict objects
    """
    parsed_counts = {}
    parsed_flavors = {}
    for count_obj in counts:
        image_name = overcloud_roles[count_obj.overcloud_role_id].image_name
        flavor_id = overcloud_roles[count_obj.overcloud_role_id].flavor_id
        count = count_obj.num_nodes
        parsed_counts[image_name] = count
        parsed_flavors[image_name] = flavor_id
    return parsed_counts, parsed_flavors
