def create_autoscale_rule(subscription_id, resource_group, vmss_name,
    metric_name, operator, threshold, direction, change_count, time_grain=
    'PT1M', time_window='PT5M', cool_down='PT1M'):
    """Create a new autoscale rule - pass the output in a list to create_autoscale_setting().

    Args:
        subscription_id (str): Azure subscription id.
        resource_group (str): Azure resource group name.
        vmss_name (str): Name of scale set to apply scale events to.
        metric_name (str): Name of metric being evaluated.
        operator (str): Operator to evaluate. E.g. "GreaterThan".
        threshold (str): Threshold to trigger action.
        direction (str): Direction of action. E.g. Increase.
        change_count (str): How many to increase or decrease by.
        time_grain (str): Optional. Measurement granularity. Default 'PT1M'.
        time_window (str): Optional. Range of time to collect data over. Default 'PT5M'.
        cool_down (str): Optional. Time to wait after last scaling action. ISO 8601 format.
            Default 'PT1M'.
    Returns:
        HTTP response. JSON body of autoscale setting.
    """
    metric_trigger = {'metricName': metric_name}
    metric_trigger['metricNamespace'] = ''
    metric_trigger['metricResourceUri'] = ('/subscriptions/' +
        subscription_id + '/resourceGroups/' + resource_group +
        '/providers/Microsoft.Compute/virtualMachineScaleSets/' + vmss_name)
    metric_trigger['timeGrain'] = time_grain
    metric_trigger['statistic'] = 'Average'
    metric_trigger['timeWindow'] = time_window
    metric_trigger['timeAggregation'] = 'Average'
    metric_trigger['operator'] = operator
    metric_trigger['threshold'] = threshold
    scale_action = {'direction': direction}
    scale_action['type'] = 'ChangeCount'
    scale_action['value'] = str(change_count)
    scale_action['cooldown'] = cool_down
    new_rule = {'metricTrigger': metric_trigger}
    new_rule['scaleAction'] = scale_action
    return new_rule
