title: How to find root domain given a child domains in R / Python
body: <p>Given a certain child domain (e.g. cardinals.mlb.com), I need to find the root domain (e.g. mlb.com).
  Can this be done in Python or R?</p>
  <p>I am not looking for Regex solutions because I have a list of 10k child domains and the way in which child domains are defined varies and there are no clear patterns in the words I would need to remove, e.g.:</p>
  <ul>
  <li>cardinals.mlb.com</li>
  <li>mlb.com/dbacks</li>
  </ul>
  <p>Another example. I would want to find fabrikam.com from any other domain listed in the picture.</p>
  <p><a href="https://i.stack.imgur.com/66kUM.png" rel="nofollow noreferrer"><img src="https://i.stack.imgur.com/66kUM.png" alt="enter image description here" /></a></p>