Earlier quoted context omitted.
I thought he's comparing the law in Iran with a similar law in the US (CAATSA I think?) directed at North Korea. I'd feel only marginally more safe violating the US's equivalent law. Breaking sanctions means prison and, at least according to Amnesty, US prisons engage in torture pretty routinely. So, I probably wouldn't merge a North Korean PR. Would you?
I happen to know that two popular machine learning libraries (MLPack and Vowpal Wabbit) have merged pull requests from North Korea. I know this because I was teaching a class on open source software development to North Korean students in 2015 (at PUST, a university in North Korea), and this was the final project for two student groups. The pull requests got merged fine, and the country of origin was never an issue.…
More importantly, in the US, there is at least some semblance of fairness in the judiciary. To be clear, I'm not saying "fairness always wins". Not even close. A criminal charge would entitle the defendant to a trial by jury, though, and I find it hard to believe that a jury would convict a teacher for merely collaborating with a student in an academic setting, regardless of the letter of the law.