title: Python: Discord API
body: <p>Here's the bit from the docs I don't understand.</p>
  
  <blockquote>
  <pre><code>purge_from(channel, *, limit=100, check=None, before=None, after=None, around=None)
  </code></pre>
    
    <p>This function is a coroutine.</p>
    
    <p>Purges a list of messages that meet the criteria given by the
    predicate check. If a check is not provided then all messages are
    deleted without discrimination.</p>
    
    <p>You must have Manage Messages permission to delete messages even if
    they are your own. The Read Message History permission is also needed
    to retrieve message history.</p>
    
    <p>Usable only by bot accounts.</p>
    
    <p>Parameters:    channel (Channel) – The channel to purge from. limit
    (int) – The number of messages to search through. This is not the
    number of messages that will be deleted, though it can be. check
    (predicate) – The function used to check if a message should be
    deleted. It must take a Message as its sole parameter.</p>
    
    <p>Examples</p>
    
    <p>Deleting bot’s messages</p>
  
  <pre><code>def is_me(m):
      return m.author == client.user
  
  deleted = await client.purge_from(channel, limit=100, check=is_me)
  await client.send_message(channel, 'Deleted {} message(s)'.format(len(deleted)))
  </code></pre>
  </blockquote>
  
  <p>I understand everything here up until the check parameter. I've tried to use the example as well as I can but I can't. What I'm trying to achieve is to purge every message that has an attachment. Message.Attachments returns an empty list if there is none. Can anyone explain the example as best as possible, or provide code? Thanks.</p>