code: def _check_yaml_and_paths(ymlfilepath, yamldefs):
          relpath = os.path.relpath(ymlfilepath)
          if '/' not in relpath:
              relpath = './%s' % relpath
          pathroot = os.path.abspath(os.path.dirname(ymlfilepath))
          for imagename, defn in iteritems(yamldefs):
              if imagename == '_SOURCES_':
                  yamldefs['_SOURCES_'] = [os.path.relpath(_get_abspath(pathroot, p))
                                           for p in yamldefs['_SOURCES_']]
                  continue
              elif imagename in SPECIAL_FIELDS:
                  continue
              for key in ('build_directory', 'FROM_DOCKERFILE', 'ignorefile'):
                  if key in defn:
                      defn[key] = _get_abspath(pathroot, defn[key])
              if 'copy_from' in defn:
                  if not isinstance(defn['copy_from'], dict):
                      raise errors.ParsingFailure((
                              'Syntax error in file "%s": \n' +
                              'The "copy_from" field in image definition "%s" is not \n' 
                              'a key:value list.') % (ymlfilepath, imagename))
                  for otherimg, value in defn.get('copy_from', {}).items():
                      if not isinstance(value, dict):
                          raise errors.ParsingFailure((
                              'Syntax error in field:\n'
                              '     %s . copy_from . %s\nin file "%s". \n'
                              'All entries must be of the form "sourcepath: destpath"')%
                                   (imagename, otherimg, ymlfilepath))
              defn['_sourcefile'] = relpath
              if 'ignore' in defn and 'ignorefile' in defn:
                  raise errors.MultipleIgnoreError(
                          'Image "%s" has both "ignore" AND "ignorefile" fields.' % imagename +
                          ' At most ONE of these should be defined')
              if 'secret_files' in defn and not defn.get('squash', True):
                  raise errors.ParsingFailure(
                          "Step '%s' defines secret_files, so 'squash' cannot be set to 'false'"
                          % imagename)
              if defn.get('secret_files', None) and defn.get('copy_from', False):
                  raise errors.ParsingFailure(
                          '`secret_files` currently is not implmemented to handle `copy_from`'
                          ' (step %s)' % imagename)
              for key in defn:
                  if key not in RECOGNIZED_KEYS:
                      raise errors.UnrecognizedKeyError(
                              'Field "%s" in image "%s" in file "%s" not recognized' %
                              (key, imagename, relpath))