'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 dimensions: dict
:param dimensions: 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 or None if you want all
metrics with that Dimension name.  To be included in the
result a metric must contain all specified dimensions,
although the metric may contain additional dimensions beyond
the requested metrics.  The Dimension names, and values must
be strings between 1 and 250 characters long. A maximum of
10 dimensions are allowed.
: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.'

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)])
