The main configure function. Uses a schema file and an optional data file,
            and combines them with user prompts to write a new data file.

def configure(self):
        """ The main configure function. Uses a schema file and an optional data file,
            and combines them with user prompts to write a new data file. """

        # Make the lazy folder if it doesn't already exist.
        path = os.getcwd() + '/' + self.lazy_folder
        if not os.path.exists(path):
            os.makedirs(path)

        schema_file = self.schema_file
        data_file = self.data_file

        # Initialise the schema and data objects.
        schema, data = Schema(), Schema()
        
        # Load the schema from a file.
        try:
            schema.load(schema_file)
        except IOError as e:

            # If we can't load the schema, choose from templates.
            self.prompt.error("Could not find schema in " + schema_file + " - Choosing from default templates...")
            schema = self.choose_schema(schema_file)
        except (Exception, ValueError) as e:
            self.prompt.error("Error: " + str(e) + " - Aborting...")
            return False
        else:
            sp, sf = os.path.split(schema_file)
            self.prompt.success('Loaded schema from ' + self.lazy_folder + sf)

        # Load the data from a file.
        try:
            data.load(data_file)
        except (Exception, IOError, ValueError) as e:
            self.prompt.error('Could not find data file. Copying from schema...')
        else:
            sp, sf = os.path.split(data_file)
            self.prompt.success('Loaded data from ' + self.lazy_folder + sf)

        # Store the internals of the schema (labels, selects, etc.) in data.
        data.internal = schema.internal

        # If we have data from a data file, merge the schema file into it.
        if data.data:

            # Create a new Merge instance using the data from the schema and data files.
            m = Merge(schema.data, data.data)
            mods = m.merge()

            for a in mods['added']:
                self.prompt.success('Added ' + a + ' to data.')

            for r in mods['removed']:
                self.prompt.error('Removed ' + r + ' from data.')

            for k,m in mods['modified']:
                self.prompt.notice('Modified ' + k + ': ' + m[0] + ' became ' + m[1] + '.' )

        # Otherwise, reference the data from the schema file verbatim.
        else:
            data.data = schema.data

        # Store the data.
        self.data = data

        # Configure the data.
        self.configure_data(data.data)

        # Save the data to the out file.
        self.data.save(self.data_file)

        self.add_ignore()

        sp, sf = os.path.split(self.data_file)
        self.prompt.success('Saved to ' + self.lazy_folder + sf + '.')