'Parses and sets the application property onto the dest_yaml parameter.
The order of precendence is:
1. Command line (-A application)
2. Specified dest_yaml file
3. App.yaml file
This exits with a parse error if application is not present in any of these
locations.
Args:
dest_yaml: The yaml object to set \'application\' on.
basename: The name of the dest_yaml file for use in errors.
appyaml: The already parsed appyaml, if present. If none, this method will
attempt to parse app.yaml.'

def _SetApplication(self, dest_yaml, basename, appyaml=None):

    if self.options.app_id:
        dest_yaml.application = self.options.app_id
    if (not dest_yaml.application):
        if (not appyaml):
            appyaml = self._ParseYamlFile(self.basepath, 'app', appinfo_includes.Parse)
        if appyaml:
            dest_yaml.application = appyaml.application
        else:
            self.parser.error(('Expected    -A    app_id    when    %s.yaml.application    is    not    set    and    app.yaml    is    not    present.' % basename))
