code: def profile_write(self, profile, outfile=None):
          
  
          # fully qualified output file
          if outfile is None:
              outfile = '{}.json'.format(profile.get('profile_name').replace(' ', '_').lower())
          fqpn = os.path.join(self.profile_dir, outfile)
  
          if os.path.isfile(fqpn):
              # append
              print('Append to File: {}{}{}'.format(c.Style.BRIGHT, c.Fore.CYAN, fqpn))
              with open(fqpn, 'r+') as fh:
                  try:
                      data = json.load(fh, object_pairs_hook=OrderedDict)
                  except ValueError as e:
                      self.handle_error('Can not parse JSON data ({}).'.format(e))
  
                  data.append(profile)
                  fh.seek(0)
                  fh.write(json.dumps(data, indent=2, sort_keys=True))
                  fh.truncate()
          else:
              print('Create File: {}{}{}'.format(c.Style.BRIGHT, c.Fore.CYAN, fqpn))
              with open(fqpn, 'w') as fh:
                  data = [profile]
                  fh.write(json.dumps(data, indent=2, sort_keys=True))
docs: Write the profile to the output directory.
  
          Args:
              profile (dict): The dictionary containting the profile settings.
              outfile (str, optional): Defaults to None. The filename for the profile.