title: Custom whitelisting domain names - Python3
body: <p>In my project, I want to whitelist a set of domains to handle requests. It should allow all requests from the listed domain, its sub-domains and different pages on the domain.</p>
  
  <p>So, if, for example, one of the whitelisted domains is <code>example.com</code>, it should serve requests for <code>www.example.com</code>, <code>abc.example.com</code>, <code>https://abc.def.example.com</code>, <code>example.com/pg1</code> etc.</p>
  
  <p>Which is the best utility/ library that can be used for this purpose? Or, do I need to write my own regex?</p>