def generate_logformat_regex(logformat):
    ' \n    Function to generate regular expression to split log messages\n    '
    headers = []
    splitters = re.split('(<[^<>]+>)', logformat)
    regex = ''
    for k in range(len(splitters)):
        if ((k % 2) == 0):
            splitter = re.sub(' +', '\\s+', splitters[k])
            regex += splitter
        else:
            header = splitters[k].strip('<').strip('>')
            regex += ('(?P<%s>.*?)' % header)
            headers.append(header)
    regex = re.compile((('^' + regex) + '$'))
    return (headers, regex)
Function to generate regular expression to split log messages
def generate_logformat_regex(logformat):
    ' \n    \n    '
    headers = []
    splitters = re.split('(<[^<>]+>)', logformat)
    regex = 
    for k in range(len(splitters)):
        if ((k % 2) == 0):
            splitter = re.sub(' +', '\\s+', splitters[k])
            regex += splitter
        else:
            header = splitters[k].strip('<').strip('>')
            regex += ('(?P<%s>.*?)' % header)
            headers.append(header)
    regex = re.compile((('^' + regex) + '$'))
    return (headers, regex)