def som(date, offset=0):
    """
    Returns start of month at a given offset for a given date
    """
    return date.replace(year=date.year + (date.month + offset - 1) // 12,
        month=(date.month - 1 + 12 * date.year + offset) % 12 + 1, day=1)
