def METHOD_NAME(stringdata, path):
    '''Writes string data to path.
    Returns the path on success, empty string on failure.'''
    try:
        fileobject = open(path, mode='wb')
        # write line-by-line to ensure proper UNIX line-endings
        for line in stringdata.splitlines():
            fileobject.write(line.encode('UTF-8') + b"\n")
        fileobject.close()
        return path
    except (OSError, IOError):
        display.display_error("Couldn't write %s" % stringdata)
        return ""