from datetime import datetime


def calculate_star_per(created_at, updated_at, star_count, day_duration=1, round_n=2):
    """

    :param created_at: e.g. 2014-09-18T16:12:01Z
    :param updated_at: e.g. 2014-09-19T16:12:01Z
    :param star_count:
    :param day_duration: if 1, it means per day. if 7, it means per week.
    :param round_n:
    :return:  day_duration * start / (days + 1)
    """
    delta = datetime.strptime(updated_at, "%Y-%m-%dT%H:%M:%SZ") - datetime.strptime(created_at, "%Y-%m-%dT%H:%M:%SZ")
    offset_for_zero_division = 1
    return day_duration * round(star_count / (delta.days + offset_for_zero_division), round_n)