Converts a string of MultiMarkdown text to the requested format.
    Transclusion is performed if the COMPATIBILITY extension is not set, and dname is set to a
    valid directory

    Keyword arguments:
    source -- string containing MultiMarkdown text
    ext -- extension bitfield to pass to conversion process
    fmt -- flag indicating output format to use
    dname -- Path to use for transclusion - if None, transclusion functionality is bypassed

def convert(source, ext=COMPLETE, fmt=HTML, dname=None):
    """Converts a string of MultiMarkdown text to the requested format.
    Transclusion is performed if the COMPATIBILITY extension is not set, and dname is set to a
    valid directory

    Keyword arguments:
    source -- string containing MultiMarkdown text
    ext -- extension bitfield to pass to conversion process
    fmt -- flag indicating output format to use
    dname -- Path to use for transclusion - if None, transclusion functionality is bypassed
    """
    if dname and not ext & COMPATIBILITY:
        if os.path.isfile(dname):
            dname = os.path.abspath(os.path.dirname(dname))
        source, _ = _expand_source(source, dname, fmt)
    _MMD_LIB.markdown_to_string.argtypes = [ctypes.c_char_p, ctypes.c_ulong, ctypes.c_int]
    _MMD_LIB.markdown_to_string.restype = ctypes.c_char_p
    src = source.encode('utf-8')
    return _MMD_LIB.markdown_to_string(src, ext, fmt).decode('utf-8')