input: 
  def create_3d_vector_class():
      """ Create a Python class which represents a 3D Vector.
      >>> vec = Vector3D(1, 2, 3)
      >>> str(vec)
      '(1, 2, 3)'
      """
      class Vector3D:
          def __init__(self, x, y, z):
              self.x = x
              self.y = y
              self.z = z
          
          def __str__(self):
              return "(" + str(self.x) + ", " + str(self.y) + ", " + str(self.z) + ")"
      
      return Vector3D
  
  # Example usage:
  # Vector3D = create_3d_vector_class()
  # vec = Vector3D(1, 2, 3)
  # print(vec)  # Output: (1, 2, 3)
  
output:     def __add__(self, other):
              return Vector3D(self.x + other.x, self.y + other.y, self.z + other.z)
          
          def __sub__(self, other):
              return Vector3D(self.x - other.x, self.y - other.y, self.z - other.z)
          
          def __mul__(self, scalar):
              return Vector3D(self.x * scalar, self.y * scalar, self.z * scalar)
          
          def __rmul__(self, scalar):
              return self.__mul__(scalar)
          
          def __eq__(self, other):
              return self.x == other.x and self.y == other.y and self.z == other.z
          
          def magnitude(self):
              return (self.x ** 2 + self.y ** 2 + self.z ** 2) ** 0.5
          
          def dot(self, other):
              return self.x * other.x + self.y * other.y + self.z * other.z
          
          def cross(self, other):
              return Vector3D(self.y * other.z - self.z * other.y,
                              self.z * other.x - self.x * other.z,
                              self.x * other.y - self.y * other.x)