Return an :class:`AsyncIterator` that enables receiving the guild's audit logs.

        You must have the :attr:`~Permissions.view_audit_log` permission to use this.

        Examples
        ----------

        Getting the first 100 entries: ::

            async for entry in guild.audit_logs(limit=100):
                print('{0.user} did {0.action} to {0.target}'.format(entry))

        Getting entries for a specific action: ::

            async for entry in guild.audit_logs(action=discord.AuditLogAction.ban):
                print('{0.user} banned {0.target}'.format(entry))

        Getting entries made by a specific user: ::

            entries = await guild.audit_logs(limit=None, user=guild.me).flatten()
            await channel.send('I made {} moderation actions.'.format(len(entries)))

        Parameters
        -----------
        limit: Optional[:class:`int`]
            The number of entries to retrieve. If ``None`` retrieve all entries.
        before: Union[:class:`abc.Snowflake`, datetime]
            Retrieve entries before this date or entry.
            If a date is provided it must be a timezone-naive datetime representing UTC time.
        after: Union[:class:`abc.Snowflake`, datetime]
            Retrieve entries after this date or entry.
            If a date is provided it must be a timezone-naive datetime representing UTC time.
        oldest_first: :class:`bool`
            If set to true, return entries in oldest->newest order. Defaults to True if
            ``after`` is specified, otherwise False.
        user: :class:`abc.Snowflake`
            The moderator to filter entries from.
        action: :class:`AuditLogAction`
            The action to filter with.

        Raises
        -------
        Forbidden
            You are not allowed to fetch audit logs
        HTTPException
            An error occurred while fetching the audit logs.

        Yields
        --------
        :class:`AuditLogEntry`
            The audit log entry.

def audit_logs(self, *, limit=100, before=None, after=None, oldest_first=None, user=None, action=None):
        """Return an :class:`AsyncIterator` that enables receiving the guild's audit logs.

        You must have the :attr:`~Permissions.view_audit_log` permission to use this.

        Examples
        ----------

        Getting the first 100 entries: ::

            async for entry in guild.audit_logs(limit=100):
                print('{0.user} did {0.action} to {0.target}'.format(entry))

        Getting entries for a specific action: ::

            async for entry in guild.audit_logs(action=discord.AuditLogAction.ban):
                print('{0.user} banned {0.target}'.format(entry))

        Getting entries made by a specific user: ::

            entries = await guild.audit_logs(limit=None, user=guild.me).flatten()
            await channel.send('I made {} moderation actions.'.format(len(entries)))

        Parameters
        -----------
        limit: Optional[:class:`int`]
            The number of entries to retrieve. If ``None`` retrieve all entries.
        before: Union[:class:`abc.Snowflake`, datetime]
            Retrieve entries before this date or entry.
            If a date is provided it must be a timezone-naive datetime representing UTC time.
        after: Union[:class:`abc.Snowflake`, datetime]
            Retrieve entries after this date or entry.
            If a date is provided it must be a timezone-naive datetime representing UTC time.
        oldest_first: :class:`bool`
            If set to true, return entries in oldest->newest order. Defaults to True if
            ``after`` is specified, otherwise False.
        user: :class:`abc.Snowflake`
            The moderator to filter entries from.
        action: :class:`AuditLogAction`
            The action to filter with.

        Raises
        -------
        Forbidden
            You are not allowed to fetch audit logs
        HTTPException
            An error occurred while fetching the audit logs.

        Yields
        --------
        :class:`AuditLogEntry`
            The audit log entry.
        """
        if user:
            user = user.id

        if action:
            action = action.value

        return AuditLogIterator(self, before=before, after=after, limit=limit,
                                oldest_first=oldest_first, user_id=user, action_type=action)