Creates a single datapoint dict with a value, timestamp and tags.

    :param value: Value of the datapoint. Type depends on the id's MetricType
    :param timestamp: Optional timestamp of the datapoint. Uses client current time if not set. Millisecond accuracy. Can be datetime instance also.
    :param tags: Optional datapoint tags. Not to be confused with metric definition tags

def create_datapoint(value, timestamp=None, **tags):
    """
    Creates a single datapoint dict with a value, timestamp and tags.

    :param value: Value of the datapoint. Type depends on the id's MetricType
    :param timestamp: Optional timestamp of the datapoint. Uses client current time if not set. Millisecond accuracy. Can be datetime instance also.
    :param tags: Optional datapoint tags. Not to be confused with metric definition tags
    """
    if timestamp is None:
        timestamp = time_millis()

    if type(timestamp) is datetime:
        timestamp = datetime_to_time_millis(timestamp)

    item = { 'timestamp': timestamp,
             'value': value }

    if tags is not None:
        item['tags'] = tags

    return item