def _add_missing_roles_to_request(missing_roles, role_to_req, req_count_fields
    ):
    """Helper for :py:func:`_igs_satisfy_request`. Add requests for
    *missing_roles* to *role_to_ig* so that we have a better chance of
    matching the cluster's actual instance groups."""
    if 'CORE' in missing_roles and list(role_to_req) == ['MASTER']:
        role_to_req['CORE'] = role_to_req['MASTER']
    if 'TASK' in missing_roles and 'CORE' in role_to_req:
        role_to_req['TASK'] = dict(role_to_req['CORE'])
        for req_count_field in req_count_fields:
            role_to_req['TASK'][req_count_field] = 0
    return role_to_req
