code: public static Form getFormFrom(Stanza packet) {
          // Check if the packet includes the DataForm extension
          DataForm dataForm = DataForm.from(packet);
          if (dataForm != null) {
              if (dataForm.getReportedData() == null)
                  return new Form(dataForm);
          }
          // Otherwise return null
          return null;
      }
docs: Returns a new ReportedData if the stanza is used for gathering data and includes an
  extension that matches the elementName and namespace "x","jabber:x:data".
  
  @param packet the stanza used for gathering data.
  @return the data form parsed from the stanza or <tt>null</tt> if there was not
  a form in the packet.