<SYSTEM_TASK:>
Solve the following problem using Python, implementing the functions described below, one line at a time
<END_TASK>
<USER_TASK:>
Description:
 def regex_filter(config, message, pattern=None, *args, **kw):
 """ All messages matching a regular expression Use this rule to include messages that bear a certain pattern. This can be anything that appears anywhere in the message (for instance, you could combine this with rules for wiki updates or Ask Fedora changes to alert yourself of activity in your area of expertise). (*i.e., (beefy miracle)*). """


    pattern = kw.get('pattern', pattern)
    if pattern:
        regex = fmn.rules.utils.compile_regex(pattern.encode('utf-8'))
        return bool(regex.search(
            fedmsg.encoding.dumps(message['msg']).encode('utf-8')
        ))