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