import re


def what_lang(filename):
    """
    Judge what language the file is written by from filename extention.
    """
    langs=[('c|cc|cpp|h', 'c/c++'),
           ('java', 'java'),
           ('sh', 'sh'),
           ('pl', 'perl'),
           ('rb', 'ruby'),
           ('py', 'python'),
           ('xml', 'xml'),
           ('txt|md', 'txt')]

    for lang in langs:
        reg = r'.+\.(' + lang[0] + r')$'
        if re.match(reg, filename):
            return lang[1]

    return 'default'