def patch_sourcefile(fname, in_text, out_text, silent_mode=False):
    import io
    if osp.isfile(fname) and not in_text == out_text:
        with io.open(fname, 'r') as fh:
            content = fh.read()
        new_content = content.replace(in_text, out_text)
        if not new_content == content:
            if not silent_mode:
                print("patching ", fname, "from", in_text, "to", out_text)
            with io.open(fname, 'wt') as fh:
                fh.write(new_content)

# =============================================================================
# Patch sourcelines (instead of forking packages)
# =============================================================================
Initialize the platform.
dataset/ETHPy150Open winpython/winpython/winpython/utils.py/patch_sourcefile--crossover with--dataset/ETHPy150Open home-assistant/home-assistant/tests/common.py/MockPlatform.__init__