Creates a gRPC client stub.

    Args:
        generated_create_stub (Callable): The generated gRPC method to create a
            stub.
        channel (grpc.Channel): A Channel object through which to make calls.
            If None, a secure channel is constructed. If specified, all
            remaining arguments are ignored.
        service_path (str): The domain name of the API remote host.
        service_port (int): The port on which to connect to the remote host.
        credentials (google.auth.credentials.Credentials): The authorization
            credentials to attach to requests. These credentials identify your
            application to the service.
        scopes (Sequence[str]): The OAuth scopes for this service. This
            parameter is ignored if a credentials is specified.
        ssl_credentials (grpc.ChannelCredentials): gRPC channel credentials
            used to create a secure gRPC channel. If not specified, SSL
            credentials will be created using default certificates.

    Returns:
        grpc.Client: A gRPC client stub.

def create_stub(generated_create_stub, channel=None, service_path=None,
                service_port=None, credentials=None, scopes=None,
                ssl_credentials=None):
    """Creates a gRPC client stub.

    Args:
        generated_create_stub (Callable): The generated gRPC method to create a
            stub.
        channel (grpc.Channel): A Channel object through which to make calls.
            If None, a secure channel is constructed. If specified, all
            remaining arguments are ignored.
        service_path (str): The domain name of the API remote host.
        service_port (int): The port on which to connect to the remote host.
        credentials (google.auth.credentials.Credentials): The authorization
            credentials to attach to requests. These credentials identify your
            application to the service.
        scopes (Sequence[str]): The OAuth scopes for this service. This
            parameter is ignored if a credentials is specified.
        ssl_credentials (grpc.ChannelCredentials): gRPC channel credentials
            used to create a secure gRPC channel. If not specified, SSL
            credentials will be created using default certificates.

    Returns:
        grpc.Client: A gRPC client stub.
    """
    if channel is None:
        target = '{}:{}'.format(service_path, service_port)

        if credentials is None:
            credentials = _grpc_google_auth.get_default_credentials(scopes)

        channel = _grpc_google_auth.secure_authorized_channel(
            credentials, target, ssl_credentials=ssl_credentials)

    return generated_create_stub(channel)