async def edit(self, **fields):
try:<EOL><INDENT>avatar_bytes = fields['<STR_LIT>']<EOL><DEDENT>except KeyError:<EOL><INDENT>avatar = self.avatar<EOL><DEDENT>else:<EOL><INDENT>if avatar_bytes is not None:<EOL><INDENT>avatar = _bytes_to_base64_data(avatar_bytes)<EOL><DEDENT>else:<EOL><INDENT>avatar = None<EOL><DEDENT><DEDENT>not_bot_account = not self.bot<EOL>password = fields.get('<STR_LIT:password>')<EOL>if not_bot_account and password is None:<EOL><INDENT>raise ClientException('<STR_LIT>')<EOL><DEDENT>args = {<EOL>'<STR_LIT:password>': password,<EOL>'<STR_LIT:username>': fields.get('<STR_LIT:username>', self.name),<EOL>'<STR_LIT>': avatar<EOL>}<EOL>if not_bot_account:<EOL><INDENT>args['<STR_LIT:email>'] = fields.get('<STR_LIT:email>', self.email)<EOL>if '<STR_LIT>' in fields:<EOL><INDENT>args['<STR_LIT>'] = fields['<STR_LIT>']<EOL><DEDENT><DEDENT>http = self._state.http<EOL>if '<STR_LIT>' in fields:<EOL><INDENT>house = fields['<STR_LIT>']<EOL>if house is None:<EOL><INDENT>await http.leave_hypesquad_house()<EOL><DEDENT>elif not isinstance(house, HypeSquadHouse):<EOL><INDENT>raise ClientException('<STR_LIT>')<EOL><DEDENT>else:<EOL><INDENT>value = house.value<EOL><DEDENT>await http.change_hypesquad_house(value)<EOL><DEDENT>data = await http.edit_profile(**args)<EOL>if not_bot_account:<EOL><INDENT>self.email = data['<STR_LIT:email>']<EOL>try:<EOL><INDENT>http._token(data['<STR_LIT>'], bot=False)<EOL><DEDENT>except KeyError:<EOL><INDENT>pass<EOL><DEDENT><DEDENT>self._update(data)<EOL>
|coro|

        Edits the current profile of the client.

        If a bot account is used then a password field is optional,
        otherwise it is required.

        Note
        -----
        To upload an avatar, a :term:`py:bytes-like object` must be passed in that
        represents the image being uploaded. If this is done through a file
        then the file must be opened via ``open('some_filename', 'rb')`` and
        the :term:`py:bytes-like object` is given through the use of ``fp.read()``.

        The only image formats supported for uploading is JPEG and PNG.

        Parameters
        -----------
        password: :class:`str`
            The current password for the client's account.
            Only applicable to user accounts.
        new_password: :class:`str`
            The new password you wish to change to.
            Only applicable to user accounts.
        email: :class:`str`
            The new email you wish to change to.
            Only applicable to user accounts.
        house: Optional[:class:`HypeSquadHouse`]
            The hypesquad house you wish to change to.
            Could be ``None`` to leave the current house.
            Only applicable to user accounts.
        username: :class:`str`
            The new username you wish to change to.
        avatar: :class:`bytes`
            A :term:`py:bytes-like object` representing the image to upload.
            Could be ``None`` to denote no avatar.

        Raises
        ------
        HTTPException
            Editing your profile failed.
        InvalidArgument
            Wrong image format passed for ``avatar``.
        ClientException
            Password is required for non-bot accounts.
            House field was not a HypeSquadHouse.