def permissions_for(self, member):
<EOL>o = self.guild.owner<EOL>if o is not None and member.id == o.id:<EOL><INDENT>return Permissions.all()<EOL><DEDENT>default = self.guild.default_role<EOL>base = Permissions(default.permissions.value)<EOL>roles = member.roles<EOL>for role in roles:<EOL><INDENT>base.value |= role.permissions.value<EOL><DEDENT>if base.administrator:<EOL><INDENT>return Permissions.all()<EOL><DEDENT>try:<EOL><INDENT>maybe_everyone = self._overwrites[<NUM_LIT:0>]<EOL>if maybe_everyone.id == self.guild.id:<EOL><INDENT>base.handle_overwrite(allow=maybe_everyone.allow, deny=maybe_everyone.deny)<EOL>remaining_overwrites = self._overwrites[<NUM_LIT:1>:]<EOL><DEDENT>else:<EOL><INDENT>remaining_overwrites = self._overwrites<EOL><DEDENT><DEDENT>except IndexError:<EOL><INDENT>remaining_overwrites = self._overwrites<EOL><DEDENT>member_role_ids = {r.id for r in roles}<EOL>denies = <NUM_LIT:0><EOL>allows = <NUM_LIT:0><EOL>for overwrite in remaining_overwrites:<EOL><INDENT>if overwrite.type == '<STR_LIT>' and overwrite.id in member_role_ids:<EOL><INDENT>denies |= overwrite.deny<EOL>allows |= overwrite.allow<EOL><DEDENT><DEDENT>base.handle_overwrite(allow=allows, deny=denies)<EOL>for overwrite in remaining_overwrites:<EOL><INDENT>if overwrite.type == '<STR_LIT>' and overwrite.id == member.id:<EOL><INDENT>base.handle_overwrite(allow=overwrite.allow, deny=overwrite.deny)<EOL>break<EOL><DEDENT><DEDENT>if not base.send_messages:<EOL><INDENT>base.send_tts_messages = False<EOL>base.mention_everyone = False<EOL>base.embed_links = False<EOL>base.attach_files = False<EOL><DEDENT>if not base.read_messages:<EOL><INDENT>denied = Permissions.all_channel()<EOL>base.value &= ~denied.value<EOL><DEDENT>return base<EOL>
Handles permission resolution for the current :class:`Member`.

        This function takes into consideration the following cases:

        - Guild owner
        - Guild roles
        - Channel overrides
        - Member overrides

        Parameters
        ----------
        member: :class:`Member`
            The member to resolve permissions for.

        Returns
        -------
        :class:`Permissions`
            The resolved permissions for the member.