code: public static synchronized OmemoManager getInstanceFor(XMPPConnection connection, Integer deviceId) {
          if (deviceId == null || deviceId < 1) {
              throw new IllegalArgumentException("DeviceId MUST NOT be null and MUST be greater than 0.");
          }
  
          TreeMap<Integer,OmemoManager> managersOfConnection = INSTANCES.get(connection);
          if (managersOfConnection == null) {
              managersOfConnection = new TreeMap<>();
              INSTANCES.put(connection, managersOfConnection);
          }
  
          OmemoManager manager = managersOfConnection.get(deviceId);
          if (manager == null) {
              manager = new OmemoManager(connection, deviceId);
              managersOfConnection.put(deviceId, manager);
          }
  
          return manager;
      }
docs: Return an OmemoManager instance for the given connection and deviceId.
  If there was an OmemoManager for the connection and id before, return it. Otherwise create a new OmemoManager
  instance and return it.
  
  @param connection XmppConnection.
  @param deviceId MUST NOT be null and MUST be greater than 0.
  
  @return manager