def rebuild(self, image, root_pass=None, authorized_keys=None, **kwargs):
ret_pass = None<EOL>if not root_pass:<EOL><INDENT>ret_pass = Instance.generate_root_password()<EOL>root_pass = ret_pass<EOL><DEDENT>authorized_keys = load_and_validate_keys(authorized_keys)<EOL>params = {<EOL>'<STR_LIT:image>': image.id if issubclass(type(image), Base) else image,<EOL>'<STR_LIT>': root_pass,<EOL>'<STR_LIT>': authorized_keys,<EOL>}<EOL>params.update(kwargs)<EOL>result = self._client.post('<STR_LIT>'.format(Instance.api_endpoint), model=self, data=params)<EOL>if not '<STR_LIT:id>' in result:<EOL><INDENT>raise UnexpectedResponseError('<STR_LIT>', json=result)<EOL><DEDENT>self._populate(result)<EOL>if not ret_pass:<EOL><INDENT>return True<EOL><DEDENT>else:<EOL><INDENT>return ret_pass<EOL><DEDENT>
Rebuilding an Instance deletes all existing Disks and Configs and deploys
a new :any:`Image` to it.  This can be used to reset an existing
Instance or to install an Image on an empty Instance.

:param image: The Image to deploy to this Instance
:type image: str or Image
:param root_pass: The root password for the newly rebuilt Instance.  If
                  omitted, a password will be generated and returned.
:type root_pass: str
:param authorized_keys: The ssh public keys to install in the linode's
                        /root/.ssh/authorized_keys file.  Each entry may
                        be a single key, or a path to a file containing
                        the key.
:type authorized_keys: list or str

:returns: The newly generated password, if one was not provided
          (otherwise True)
:rtype: str or bool