code: def wait_for_boot_completion(
              self, timeout=DEFAULT_TIMEOUT_BOOT_COMPLETION_SECOND):
          
          timeout_start = time.time()
  
          self.adb.wait_for_device(timeout=timeout)
          while time.time() < timeout_start + timeout:
              try:
                  if self.is_boot_completed():
                      return
              except adb.AdbError:
                  # adb shell calls may fail during certain period of booting
                  # process, which is normal. Ignoring these errors.
                  pass
              time.sleep(5)
          raise DeviceError(self, 'Booting process timed out')
docs: Waits for Android framework to broadcast ACTION_BOOT_COMPLETED.
  
          This function times out after 15 minutes.
  
          Args:
              timeout: float, the number of seconds to wait before timing out.
                  If not specified, no timeout takes effect.