def guess_file_type(file_name, file_type=None):
    """
    Guess the type of a file name
    """
    file_extensions = {'svg': ['svg'], 'pdf': ['pdf'], 'png': ['png'],
        'jpeg': ['jpg', 'jpeg'], 'gif': ['gif']}
    if file_type is None:
        try:
            ext = file_name.lower().split('.')[-1]
            for file_type in file_extensions:
                if ext in file_extensions[file_type]:
                    break
        except TypeError:
            print('Unknown file type for file name: ' + file_name + '.')
    return file_type
