def get_hosts_by_role(self, role, hosts=None):
    hosts = (hosts or self.api_client.get_cluster_hosts(self.id))
    nodes_by_role = []
    for host in hosts:
        if (host['role'] == role):
            nodes_by_role.append(host)
    log.info(f'Found hosts: {nodes_by_role}, that has the role: {role}')
    return nodes_by_role
def get_hosts_by_role(self, role, hosts=None):
    hosts = (hosts or self.api_client.get_cluster_hosts(self.id))
    nodes_by_role = []
    for host in hosts:
        if (host['role'] == role):
            nodes_by_role.append(host)
    log.info(f'Found hosts: {nodes_by_role}, that has the role: {role}')
    return nodes_by_role