'Filter out input datastores that do not match the given profile.'

def _filter_by_profile(self, datastores, profile_id):

    cf = self._session.pbm.client.factory
    hubs = pbm.convert_datastores_to_hubs(cf, datastores)
    hubs = pbm.filter_hubs_by_profile(self._session, hubs, profile_id)
    hub_ids = [hub.hubId for hub in hubs]
    return {k: v for (k, v) in datastores.items() if (k.value in hub_ids)}
