code: def list_metrics(self, next_token=None, dimensions=None,
                       metric_name=None, namespace=None):
          
          params = {}
          if next_token:
              params['NextToken'] = next_token
          if dimensions:
              self.build_dimension_param(dimensions, params)
          if metric_name:
              params['MetricName'] = metric_name
          if namespace:
              params['Namespace'] = namespace
          
          return self.get_list('ListMetrics', params, [('member', Metric)])
docs: Returns a list of the valid metrics for which there is recorded
          data available.
  
          :type next_token: str
          :param next_token: A maximum of 500 metrics will be returned at one
                             time.  If more results are available, the
                             ResultSet returned will contain a non-Null
                             next_token attribute.  Passing that token as a
                             parameter to list_metrics will retrieve the
                             next page of metrics.
  
          :type dimension: dict
          :param dimension_filters: A dictionary containing name/value pairs
                                    that will be used to filter the results.
                                    The key in the dictionary is the name of
                                    a Dimension.  The value in the dictionary
                                    is either a scalar value of that Dimension
                                    name that you want to filter on, a list
                                    of values to filter on or None if
                                    you want all metrics with that Dimension name.
  
          :type metric_name: str
          :param metric_name: The name of the Metric to filter against.  If None,
                              all Metric names will be returned.
  
          :type namespace: str
          :param namespace: A Metric namespace to filter against (e.g. AWS/EC2).
                            If None, Metrics from all namespaces will be returned.