def month_interval(year, month, return_str=False):
        """
        
        Usage Example::
        
            >>> timewrapper.day_interval(2014, 12)
            (datetime(2014, 12, 1, 0, 0, 0), datetime(2014, 12, 31, 23, 59, 59))
        """
        if month == 12:
            start, end = datetime(year, month, 1), datetime(year+1, 1, 1) - timedelta(seconds=1)
        else:
            start, end = datetime(year, month, 1), datetime(year, month+1, 1) - timedelta(seconds=1)
            
        if not return_str:
            return start, end
        else:
            return str(start), str(end)
def month_interval ( year , month , return_str = False ) : if month == 12 : start , end = datetime ( year , month , 1 ) , datetime ( year + 1 , 1 , 1 ) - timedelta ( seconds = 1 ) else : start , end = datetime ( year , month , 1 ) , datetime ( year , month + 1 , 1 ) - timedelta ( seconds = 1 ) if not return_str : return start , end else : return str ( start ) , str ( end )
Usage Example::
        
            >>> timewrapper.day_interval(2014, 12)
            (datetime(2014, 12, 1, 0, 0, 0), datetime(2014, 12, 31, 23, 59, 59))