#NEWLINE# def datetime_from_iso8601( value ) : #NEWLINE# #INDENT# '\n    Turns an ISO8601 formatted date into a datetime object.\n\n    Example::\n\n        inputs.datetime_from_iso8601("2012-01-01T23:30:00+02:00")\n\n    :param str value: The ISO8601-complying string to transform\n    :return: A datetime\n    :rtype: datetime\n    :raises ValueError: if value is an invalid date literal\n\n    ' #NEWLINE# try : #NEWLINE# #INDENT# try : #NEWLINE# #INDENT# return aniso8601 . parse_datetime ( date ) #NEWLINE# #UNINDENT# except ValueError : #NEWLINE# #INDENT# date = aniso8601 . parse_date ( value ) #NEWLINE# return datetime ( date . year , date . month , date . day ) #NEWLINE# #UNINDENT# #UNINDENT# except : #NEWLINE# #INDENT# raise ValueError ( 'Invalid date literal "{0}"' . format ( value ) )