# Path: aerofiles/igc/patterns.py
# DATE = re.compile('^([0-3][0-9])([0-1][0-9])([0-9]{2})$')
# TIME = re.compile('^([0-2][0-9])([0-5][0-9])([0-5][0-9])$')
# DATETIME = re.compile('^([0-3][0-9])([0-1][0-9])([0-9]{2})'
#                       '([0-2][0-9])([0-5][0-9])([0-5][0-9])$')
# THREE_LETTER_CODE = re.compile('^[A-Z0-9]{3}$')
# MANUFACTURER_CODE = THREE_LETTER_CODE
# LOGGER_ID = THREE_LETTER_CODE
# EXTENSION_CODE = THREE_LETTER_CODE


import datetime
from aerofiles.igc import patterns
                turnpoints=3,
            )
            # -> C140413125302000000004203

        There are sensible defaults in place for all parameters except for the
        ``turnpoints`` parameter. If you don't pass that parameter the method
        will raise a :class:`ValueError`. The other parameter defaults are
        mentioned in the list below.

        :param declaration_datetime: a :class:`datetime.datetime` instance of
            the UTC date and time at the time of declaration (default: current
            date and time)
        :param flight_date: a :class:`datetime.date` instance of the intended
            date of the flight (default: ``000000``, which means "use
            declaration date")
        :param task_number: task number for the flight date or an integer-based
            identifier (default: ``0001``)
        :param turnpoints: the number of turnpoints in the task (not counting
            start and finish points!)
        :param text: optional text to append to the metadata record
        """

        if declaration_datetime is None:
            declaration_datetime = datetime.datetime.utcnow()

        if isinstance(declaration_datetime, datetime.datetime):
            declaration_datetime = (
                self.format_date(declaration_datetime) +
                self.format_time(declaration_datetime)
            )

# Path: aerofiles/igc/patterns.py
# DATE = re.compile('^([0-3][0-9])([0-1][0-9])([0-9]{2})$')
# TIME = re.compile('^([0-2][0-9])([0-5][0-9])([0-5][0-9])$')
# DATETIME = re.compile('^([0-3][0-9])([0-1][0-9])([0-9]{2})'
#                       '([0-2][0-9])([0-5][0-9])([0-5][0-9])$')
# THREE_LETTER_CODE = re.compile('^[A-Z0-9]{3}$')
# MANUFACTURER_CODE = THREE_LETTER_CODE
# LOGGER_ID = THREE_LETTER_CODE
# EXTENSION_CODE = THREE_LETTER_CODE


# Path: aerofiles/igc/writer.py
import datetime
from aerofiles.igc import patterns

                turnpoints=3,
            )
            # -> C140413125302000000004203

        There are sensible defaults in place for all parameters except for the
        ``turnpoints`` parameter. If you don't pass that parameter the method
        will raise a :class:`ValueError`. The other parameter defaults are
        mentioned in the list below.

        :param declaration_datetime: a :class:`datetime.datetime` instance of
            the UTC date and time at the time of declaration (default: current
            date and time)
        :param flight_date: a :class:`datetime.date` instance of the intended
            date of the flight (default: ``000000``, which means "use
            declaration date")
        :param task_number: task number for the flight date or an integer-based
            identifier (default: ``0001``)
        :param turnpoints: the number of turnpoints in the task (not counting
            start and finish points!)
        :param text: optional text to append to the metadata record
        """

        if declaration_datetime is None:
            declaration_datetime = datetime.datetime.utcnow()

        if isinstance(declaration_datetime, datetime.datetime):
            declaration_datetime = (
                self.format_date(declaration_datetime) +
                self.format_time(declaration_datetime)
            )

        elif not patterns.DATETIME.match(declaration_datetime):