'Find the source code of the callable or pretty-print the dictionary'

def event_filter_to_descriptive_string(self, event_filter):

    message = ''
    if callable(event_filter):
        file_name = '(unknown)'
        try:
            file_name = inspect.getsourcefile(event_filter)
        except TypeError:
            pass
        try:
            (list_of_source_lines, line_no) = inspect.getsourcelines(event_filter)
        except IOError:
            pass
        else:
            message = '{file_name}:{line_no}\n{hr}\n{event_filter}\n{hr}'.format(event_filter=''.join(list_of_source_lines).rstrip(), file_name=file_name, line_no=line_no, hr=('-' * 20))
    if (not message):
        message = '{hr}\n{event_filter}\n{hr}'.format(event_filter=pprint.pformat(event_filter), hr=('-' * 20))
    return message
