def date(*args, **kwargs):
 d = None
 f = None
 if ((len(args) == 0) and (kwargs.get('year') is not None) and kwargs.get('month') and kwargs.get('day')):
  d = Date(**kwargs)
 elif kwargs.get('week'):
  f = kwargs.pop('format', None)
  d = Date(*_yyyywwd2yyyymmdd(kwargs.pop('year', ((args and args[0]) or Date.now().year)), kwargs.pop('week'), kwargs.pop('weekday', kwargs.pop('day', 1))), **kwargs)
 elif ((len(args) == 0) or (args[0] == NOW)):
  d = Date.now()
 elif ((len(args) == 1) and isinstance(args[0], (Date, datetime))):
  d = Date.fromtimestamp(int(mktime(args[0].timetuple())))
  d += time(microseconds=args[0].microsecond)
 elif ((len(args) == 1) and (isinstance(args[0], int) or (isinstance(args[0], basestring) and args[0].isdigit()))):
  d = Date.fromtimestamp(int(args[0]))
 elif ((len(args) == 1) and isinstance(args[0], basestring)):
  try:
   d = Date.fromtimestamp(mktime_tz(parsedate_tz(args[0])))
  except:
   for format in (((('format' in kwargs) and [kwargs['format']]) or []) + date_formats):
    try:
     d = Date.strptime(args[0], format)
     break
    except:
     pass
  if (d is None):
   raise DateError(('unknown date format for %s' % repr(args[0])))
 elif ((len(args) == 2) and isinstance(args[0], basestring)):
  d = Date.strptime(args[0], args[1])
 elif (len(args) >= 3):
  f = kwargs.pop('format', None)
  d = Date(*args[:7], **kwargs)
 else:
  raise DateError('unknown date format')
 d.format = (kwargs.get('format') or ((len(args) > 7) and args[7]) or f or Date.format)
 return d

def date ( * args , ** kwargs ) : d = None f = None if ( ( len ( args ) == 0 ) and ( kwargs . get ( 'year' ) is not None ) and kwargs . get ( 'month' ) and kwargs . get ( 'day' ) ) : d = Date ( ** kwargs ) elif kwargs . get ( 'week' ) : f = kwargs . pop ( 'format' , None ) d = Date ( * _yyyywwd2yyyymmdd ( kwargs . pop ( 'year' , ( ( args and args [ 0 ] ) or Date . now ( ) . year ) ) , kwargs . pop ( 'week' ) , kwargs . pop ( 'weekday' , kwargs . pop ( 'day' , 1 ) ) ) , ** kwargs ) elif ( ( len ( args ) == 0 ) or ( args [ 0 ] == NOW ) ) : d = Date . now ( ) elif ( ( len ( args ) == 1 ) and isinstance ( args [ 0 ] , ( Date , datetime ) ) ) : d = Date . fromtimestamp ( int ( mktime ( args [ 0 ] . timetuple ( ) ) ) ) d += time ( microseconds = args [ 0 ] . microsecond ) elif ( ( len ( args ) == 1 ) and ( isinstance ( args [ 0 ] , int ) or ( isinstance ( args [ 0 ] , basestring ) and args [ 0 ] . isdigit ( ) ) ) ) : d = Date . fromtimestamp ( int ( args [ 0 ] ) ) elif ( ( len ( args ) == 1 ) and isinstance ( args [ 0 ] , basestring ) ) : try : d = Date . fromtimestamp ( mktime_tz ( parsedate_tz ( args [ 0 ] ) ) ) except : for format in ( ( ( ( 'format' in kwargs ) and [ kwargs [ 'format' ] ] ) or [ ] ) + date_formats ) : try : d = Date . strptime ( args [ 0 ] , format ) break except : pass if ( d is None ) : raise DateError ( ( 'unknown date format for %s' % repr ( args [ 0 ] ) ) ) elif ( ( len ( args ) == 2 ) and isinstance ( args [ 0 ] , basestring ) ) : d = Date . strptime ( args [ 0 ] , args [ 1 ] ) elif ( len ( args ) >= 3 ) : f = kwargs . pop ( 'format' , None ) d = Date ( * args [ : 7 ] , ** kwargs ) else : raise DateError ( 'unknown date format' ) d . format = ( kwargs . get ( 'format' ) or ( ( len ( args ) > 7 ) and args [ 7 ] ) or f or Date . format ) return d
return the current date .