anchor.diff:  get_stanza_with_metadata(Client, Name, Timeout) ->
       get_stanza_with_metadata(Client, Name, Timeout, fun(_) -> true end).
   
  --spec get_stanza_with_metadata(client(), any(), timeout(), filter_pred()) ->
  +-spec get_stanza_with_metadata(client(), any(), timeout(), stanza_pred()) ->
                                         {exml_stream:element(), metadata()}.
   get_stanza_with_metadata(Client, Name, Timeout, Pred) ->
       case get_stanza_safe(Client, Timeout, Pred) of
  
positive.code: 
  -spec get_stanza(client(), any(), timeout()) -> exml_stream:element().
  get_stanza(Client, Name, Timeout) ->
      get_stanza(Client, Name, Timeout, none).
  
  -spec get_stanza(client(), any(), timeout(), filter_pred()) -> exml_stream:element().
  get_stanza(Client, Name, Timeout, Pred) ->
      case get_stanza_safe(Client, Timeout, Pred) of
          {error, timeout} ->
  
negative.code: 
  -spec get_stanza_safe(client(), timeout()) -> {error, timeout} | {exml_stream:element(), metadata()}.
  get_stanza_safe(Client, Timeout) ->
      get_stanza_safe(Client, Timeout, fun(_) -> true end).
  
  -spec get_stanza_safe(client(), timeout(), stanza_pred()) ->
      {error, timeout} | {exml_stream:element(), metadata()}.
  get_stanza_safe(Client, Timeout, Pred) ->
      Handler = fun(Stanza, Metadata) ->
                        case Pred(Stanza) of
                            true -> {finish, {Stanza, Metadata}};
                            false ->
                                handle_received_stanza(Client, Stanza, Metadata),
                                continue
                        end
                end,
      receive_stanzas(Client, Timeout, Handler).
  
  -spec wait(client(), timeout()) -> ok.
  wait(Client, Timeout) ->
      Handler = fun(Stanza, Metadata) ->
                        handle_received_stanza(Client, Stanza, Metadata),
                        continue
                end,
      {error, timeout} = receive_stanzas(Client, Timeout, Handler),
      ok.
  
  -spec wait_forever(client()) -> no_return().
  