import re


def get_document_type(doc):
    """
    Returns the type of document in lower case

    :param doc: (str) The document string (to be analyzed)

    :return doc_type: (str) Document type lowercase
    """

    type_pattern = re.compile(r'<TYPE>\S+')
    match = next(type_pattern.finditer(doc))

    return doc[match.start()+6:match.end()].lower()