def display_time(seconds, granularity=1):
    """ Turns seconds into weeks, days, hours, minutes and seconds.
    Granularity determines how many time units should be returned. EG:
    # 2 time unites, week and day
    1934815, 2 = '3 weeks, 1 day'
    # 4 time units
    1934815, 4 = '3 weeks, 1 day, 9 hours, 26 minutes'
    """
    result = []
    intervals = (
        # weeks weren't necessary so I removed them
        ('days', 86400),    # 60 * 60 * 24
        ('hours', 3600),    # 60 * 60
        ('minutes', 60),
        ('seconds', 1),
    )
    for name, count in intervals:
        value = seconds // count
        if value:
            seconds -= value * count
            if value == 1:
                name = name.rstrip('s')
            result.append("{} {}".format(value, name))
    return ' '.join(result[:granularity])