code: def times(self, other):
          
          if isinstance(other, ScalarType):
              other = asarray(other)
              index = self.index
          else:
              if isinstance(other, list):
                  other = asarray(other)
              if isinstance(other, ndarray) and other.ndim < 2:
                  other = expand_dims(other, 1)
              if not self.shape[1] == other.shape[0]:
                  raise ValueError('shapes %s and %s are not aligned' % (self.shape, other.shape))
              index = arange(other.shape[1])
  
          if self.mode == 'local' and isinstance(other, Series) and other.mode == 'spark':
              raise NotImplementedError
  
          if self.mode == 'spark' and isinstance(other, Series) and other.mode == 'spark':
              raise NotImplementedError
  
          if self.mode == 'local' and isinstance(other, (ndarray, ScalarType)):
              return self._constructor(dot(self.values, other), index=index)
  
          if self.mode == 'local' and isinstance(other, Series):
              return self._constructor(dot(self.values, other.values), index=index)
  
          if self.mode == 'spark' and isinstance(other, (ndarray, ScalarType)):
              return self.map(lambda x: dot(x, other), index=index)
  
          if self.mode == 'spark' and isinstance(other, Series):
              return self.map(lambda x: dot(x, other.values), index=index)
docs: Multiply a matrix by another one.
  
          Other matrix must be a numpy array, a scalar,
          or another matrix in local mode.
  
          Parameters
          ----------
          other : Matrix, scalar, or numpy array
              A matrix to multiply with