def create_section(self, attribute, name=None):
    '''create a section based on key, value recipe pairs, 
       This is used for files or label

      Parameters
      ==========
      attribute: the name of the data section, either labels or files
      name: the name to write to the recipe file (e.g., %name).
            if not defined, the attribute name is used.

    '''

    # Default section name is the same as attribute
    if name is None:
        name = attribute 

    # Put a space between sections
    section = ['\n']

    # Only continue if we have the section and it's not empty
    try:
        section = getattr(self, attribute)
    except AttributeError:
        bot.debug('Recipe does not have section for %s' %attribute)
        return section

    # if the section is empty, don't print it
    if len(section) == 0:
        return section

    # Files or Labels
    if attribute in ['labels', 'files']:
        return create_keyval_section(section, name)

    # An environment section needs exports
    if attribute in ['environ']:
        return create_env_section(section, name)

    # Post, Setup
    return finish_section(section, name)