Creates a ``GaxError`` or subclass.

    Attributes:
        msg (string): describes the error that occurred.
        cause (Exception, optional): the exception raised by a lower
            layer of the RPC stack (for example, gRPC) that caused this
            exception, or None if this exception originated in GAX.

    Returns:
        .GaxError: The exception that wraps ``cause``.

def create_error(msg, cause=None):
    """Creates a ``GaxError`` or subclass.

    Attributes:
        msg (string): describes the error that occurred.
        cause (Exception, optional): the exception raised by a lower
            layer of the RPC stack (for example, gRPC) that caused this
            exception, or None if this exception originated in GAX.

    Returns:
        .GaxError: The exception that wraps ``cause``.
    """
    status_code = config.exc_to_code(cause)
    status_name = config.NAME_STATUS_CODES.get(status_code)
    if status_name == 'INVALID_ARGUMENT':
        return InvalidArgumentError(msg, cause=cause)
    else:
        return GaxError(msg, cause=cause)