title: Merge two tables on one key where the date is closest and on another key where the value lies in any two columns
body: <p>I have two tables df1 that looks like:</p>
  <pre><code>| DATE      | NAME           | TEAM     |
  
  | 2014-05-02| Mo Salah       | Liverpool|
  </code></pre>
  <p>and df2 that looks like:</p>
  <pre><code>|GameKey| Game_Date | Home_Team      | Away_Team  |
  
  |1      | 2014-08-03| Liverpool      | Brighton   |
  </code></pre>
  <p>How can I merge them in such a way  that df1.TEAM is in one of df2.Home_Team or df2.Away_Team and df1.DATE gives me the closest forward match to df2.Game_Date. I'm familiar with merge_asof and can use that to do a forward match on the dates but not entirely sure on how to combine that with the team names merge.</p>