<SYSTEM_TASK:>
Solve the following problem using Python, implementing the functions described below, one line at a time
<END_TASK>
<USER_TASK:>
Description:
 def get_file_link(node, use_metadata=False, include_size=False, include_extension=False, include_icon=False, href=None, extra_class='', extra=''):
 """ Returns a formatted HTML link tag to the FileNode's file, optionally including some meta information about the file. """

    link_text = None
    if use_metadata:
        link_text = node.get_metadata_display()
    if not link_text:
        link_text = node.__unicode__()
    if node.node_type != media_types.FOLDER:
        if include_extension:
            if extra != '':
                extra += ' '
            extra = '<span class="file-extension">%s</span>' % node.extension.upper()
        if include_size:
            if extra != '':
                extra += ', '
            extra += '<span class="file-size">%s</span>' % filesizeformat(node.size)
        if extra:
            extra = ' <span class="details">(%s)</span>' % extra
        link_class = 'file %s' % node.extension
    else:
        link_class = 'folder'
    if extra_class:
        link_class = '%s %s' % (link_class, extra_class)

    if node.node_type != media_types.FOLDER and not href:
        href = node.file.url

    icon = ''
    if include_icon:
        icon_file = node.get_icon_file()
        if icon_file:
            icon = '<span class="icon"><img src="%s" alt="%s" /></span>' % (
                icon_file.url, node.alt)

    if href:
        link = u'<a class="%s" href="%s">%s%s</a>%s' % (
            link_class, href, icon, link_text, extra)
    else:
        link = u'<span class="%s">%s%s</span>%s' % (
            link_class, icon, link_text, extra)

    return force_unicode(mark_safe(link))