<SYSTEM_TASK:>
Solve the following problem using Python, implementing the functions described below, one line at a time
<END_TASK>
<USER_TASK:>
Description:
 def _wrap_client_error(e):
 """ Wrap botocore ClientError exception into ServerlessRepoClientError. :param e: botocore exception :type e: ClientError :return: S3PermissionsRequired or InvalidS3UriError or general ServerlessRepoClientError """

    error_code = e.response['Error']['Code']
    message = e.response['Error']['Message']

    if error_code == 'BadRequestException':
        if "Failed to copy S3 object. Access denied:" in message:
            match = re.search('bucket=(.+?), key=(.+?)$', message)
            if match:
                return S3PermissionsRequired(bucket=match.group(1), key=match.group(2))
        if "Invalid S3 URI" in message:
            return InvalidS3UriError(message=message)

    return ServerlessRepoClientError(message=message)