def METHOD_NAME(process, input):
    if input:
        try:
            process.stdin.write(input)
        except BrokenPipeError:
            pass  # communicate() must ignore broken pipe errors.
        except ValueError:
            pass  # communicate() must ignore broken closed pipes
        except OSError as exc:
            if exc.errno == errno.EINVAL:
                # bpo-19612, bpo-30418: On Windows, stdin.write() fails
                # with EINVAL if the child process exited or if the child
                # process is still running but closed the pipe.
                pass
            else:
                raise
    try:
        process.stdin.close()
    except BrokenPipeError:
        pass  # communicate() must ignore broken pipe errors.
    except ValueError:
        pass  # communicate() must ignore broken closed pipes
    except OSError as exc:
        if exc.errno == errno.EINVAL:
            pass
        else:
            raise