azure-common/azure/common/client_factory.py
def _instantiate_client(client_class, **kwargs):
    """Instantiate a client from kwargs, removing the subscription_id/tenant_id argument if unsupported.
    """
    args = get_arg_spec(client_class.__init__).args
    for key in ['subscription_id', 'tenant_id']:
        if key not in kwargs:
            continue
        if key not in args:
            del kwargs[key]
        elif sys.version_info < (3, 0) and isinstance(kwargs[key], unicode):
            kwargs[key] = kwargs[key].encode('utf-8')
    return client_class(**kwargs)
def _instantiate_client(client_class, **kwargs):
    """Instantiate a client from kwargs, removing the subscription_id/tenant_id argument if unsupported.
    """
    args = get_arg_spec(client_class.__init__).args
    for key in ['subscription_id', 'tenant_id']:
        if key not in kwargs:
            continue
        if key not in args:
            del kwargs[key]
        elif sys.version_info < (3, 0) and isinstance(kwargs[key], unicode):
            kwargs[key] = kwargs[key].encode('utf-8')
    return client_class(**kwargs)
Instantiate a client from kwargs, removing the subscription_id/tenant_id argument if unsupported.