def format_cloudwatch_metric_datapoint_for_hostedgraphite(cloudwatch_metric_datapoint, result):
    """Given a cloudwatch metric datapoint convert it into the format hostedgraphite expects."""
    hostedgraphite_metric_name = (
        cloudwatch_metric_datapoint['Options']['Formatter'] % {'statistic': cloudwatch_metric_datapoint['Statistics']}
    ).lower()
    return '{0} {1} {2}'.format(
        hostedgraphite_metric_name,
        result[cloudwatch_metric_datapoint['Statistics']],
        result['Timestamp'].strftime('%s')
    )