def METHOD_NAME(pattern, prefix=api.API_PREFIX):
    """Create a callback function from a text pattern.
    Args:
        pattern (str): String to match on the log.
        prefix (str): regular expression used as prefix before the pattern.
    Returns:
        lambda: function that returns if there's a match in the file
    """
    pattern = r'\s+'.join(pattern.split())
    regex = re.compile(r'{}{}'.format(prefix, pattern))
    return lambda line: regex.match(line) is not None