def METHOD_NAME(source_filename, target_filename, replacements={}):
    target_dir = os.path.dirname(target_filename)
    if not os.path.exists(target_dir):
        os.makedirs(target_dir)
    with open(source_filename) as f:
        content = f.read()
    with open(target_filename, mode="w") as f:
        for from_str in replacements:
            to_str = replacements[from_str]
            content = content.replace(from_str, to_str)
        f.write(content)
    # Seems that even desktop files have to be executable
    # https://help.ubuntu.com/community/UnityLaunchersAndDesktopFiles
    os.chmod(target_filename, 0o755)