Update an example so mypy type checking works for non standard API
methods.
from libcloud.compute.types import Provider
from libcloud.compute.providers import get_driver
-EC2 = get_driver(Provider.EC2)
-Rackspace = get_driver(Provider.RACKSPACE)
+from libcloud.compute.drivers.ec2 import EC2NodeDriver
+from libcloud.compute.drivers.rackspace import RackspaceNodeDriver
+
+from typing import Type, cast
+
+ec2_cls = get_driver(Provider.EC2)
+rackspace_cls = get_driver(Provider.RACKSPACE)
+
+# NOTE: If you are using driver methods which are not part of the standard API,
+# you need to explicitly cast the driver class reference to the correct class
+# for type checking to work correctly
+EC2 = cast(Type[EC2NodeDriver], ec2_cls)
+Rackspace = cast(Type[RackspaceNodeDriver], rackspace_cls)
drivers = [EC2('access key id', 'secret key', region='us-east-1'),
Rackspace('username', 'api key', region='iad')]
