code: def truncate(self, max_length):
          
  
          if self.length() > max_length:
  
              # If it's longer than the max_length, scale to the max_length.
              self.scale(max_length / self.length())
docs: Truncate this vector so it's length does not exceed max.