title: Python typing - is there a way to avoid importing of optional type if it's None?
body: <p>Let's say we have a function definition like this:</p>
  
  <pre class="lang-py prettyprint-override"><code>def f(*, model: Optional[Type[pydantic.BaseModel]] = None)
  </code></pre>
  
  <p>So the function doesn't require <code>pydantic</code> to be installed until you pass something as a <code>model</code>. Now let's say we want to pack the function into pypi package. And my question is if there's a way to avoid bringing <code>pydantic</code> into the package dependencies only the sake of type checking?</p>