code: def _register_rp(session, url_prefix, rp_name):
      
      post_url = "{}providers/{}/register?api-version=2016-02-01".format(url_prefix, rp_name)
      get_url = "{}providers/{}?api-version=2016-02-01".format(url_prefix, rp_name)
      _LOGGER.warning("Resource provider '%s' used by this operation is not "
                      "registered. We are registering for you.", rp_name)
      post_response = session.post(post_url)
      if post_response.status_code != 200:
          _LOGGER.warning("Registration failed. Please register manually.")
          return False
  
      while True:
          time.sleep(10)
          rp_info = session.get(get_url).json()
          if rp_info['registrationState'] == 'Registered':
              _LOGGER.warning("Registration succeeded.")
              return True
docs: Synchronously register the RP is paremeter.
      
      Return False if we have a reason to believe this didn't work