def handle_transforms(self, element, mobject):
    (x, y) = (0, 0)
    try:
        x = self.attribute_to_float(element.getAttribute('x'))
        y = (- self.attribute_to_float(element.getAttribute('y')))
        mobject.shift(((x * RIGHT) + (y * UP)))
    except:
        pass
    transform = element.getAttribute('transform')
    try:
        prefix = 'matrix('
        suffix = ')'
        if ((not transform.startswith(prefix)) or (not transform.endswith(suffix))):
            raise Exception()
        transform = transform[len(prefix):(- len(suffix))]
        transform = string_to_numbers(transform)
        transform = np.array(transform).reshape([3, 2])
        x = transform[2][0]
        y = (- transform[2][1])
        matrix = np.identity(self.dim)
        matrix[:2, :2] = transform[:2, :]
        matrix[1] *= (- 1)
        matrix[:, 1] *= (- 1)
        for mob in mobject.family_members_with_points():
            mob.points = np.dot(mob.points, matrix)
        mobject.shift(((x * RIGHT) + (y * UP)))
    except:
        pass
    try:
        prefix = 'scale('
        suffix = ')'
        if ((not transform.startswith(prefix)) or (not transform.endswith(suffix))):
            raise Exception()
        transform = transform[len(prefix):(- len(suffix))]
        scale_values = string_to_numbers(transform)
        if (len(scale_values) == 2):
            (scale_x, scale_y) = scale_values
            mobject.scale(np.array([scale_x, scale_y, 1]), about_point=ORIGIN)
        elif (len(scale_values) == 1):
            scale = scale_values[0]
            mobject.scale(np.array([scale, scale, 1]), about_point=ORIGIN)
    except:
        pass
    try:
        prefix = 'translate('
        suffix = ')'
        if ((not transform.startswith(prefix)) or (not transform.endswith(suffix))):
            raise Exception()
        transform = transform[len(prefix):(- len(suffix))]
        (x, y) = string_to_numbers(transform)
        mobject.shift(((x * RIGHT) + (y * DOWN)))
    except:
        pass
def handle_transforms(self, element, mobject):
    (x, y) = (0, 0)
    try:
        x = self.attribute_to_float(element.getAttribute('x'))
        y = (- self.attribute_to_float(element.getAttribute('y')))
        mobject.shift(((x * RIGHT) + (y * UP)))
    except:
        pass
    transform = element.getAttribute('transform')
    try:
        prefix = 'matrix('
        suffix = ')'
        if ((not transform.startswith(prefix)) or (not transform.endswith(suffix))):
            raise Exception()
        transform = transform[len(prefix):(- len(suffix))]
        transform = string_to_numbers(transform)
        transform = np.array(transform).reshape([3, 2])
        x = transform[2][0]
        y = (- transform[2][1])
        matrix = np.identity(self.dim)
        matrix[:2, :2] = transform[:2, :]
        matrix[1] *= (- 1)
        matrix[:, 1] *= (- 1)
        for mob in mobject.family_members_with_points():
            mob.points = np.dot(mob.points, matrix)
        mobject.shift(((x * RIGHT) + (y * UP)))
    except:
        pass
    try:
        prefix = 'scale('
        suffix = ')'
        if ((not transform.startswith(prefix)) or (not transform.endswith(suffix))):
            raise Exception()
        transform = transform[len(prefix):(- len(suffix))]
        scale_values = string_to_numbers(transform)
        if (len(scale_values) == 2):
            (scale_x, scale_y) = scale_values
            mobject.scale(np.array([scale_x, scale_y, 1]), about_point=ORIGIN)
        elif (len(scale_values) == 1):
            scale = scale_values[0]
            mobject.scale(np.array([scale, scale, 1]), about_point=ORIGIN)
    except:
        pass
    try:
        prefix = 'translate('
        suffix = ')'
        if ((not transform.startswith(prefix)) or (not transform.endswith(suffix))):
            raise Exception()
        transform = transform[len(prefix):(- len(suffix))]
        (x, y) = string_to_numbers(transform)
        mobject.shift(((x * RIGHT) + (y * DOWN)))
    except:
        pass