'Wraps a bare string, which may have an attribute portion (ie. foo.bar)
in jinja2 variable braces so that it is evaluated properly.'

def _convert_bare_variable(self, variable, bare_deprecated):

    if isinstance(variable, string_types):
        contains_filters = ('|' in variable)
        first_part = variable.split('|')[0].split('.')[0].split('[')[0]
        if ((contains_filters or (first_part in self._available_variables)) and (self.environment.variable_start_string not in variable)):
            if bare_deprecated:
                display.deprecated(("Using    bare    variables    is    deprecated.    Update    your    playbooks    so    that    the    environment    value    uses    the    full    variable    syntax    ('%s%s%s')" % (self.environment.variable_start_string, variable, self.environment.variable_end_string)), version='2.7')
            return ('%s%s%s' % (self.environment.variable_start_string, variable, self.environment.variable_end_string))
    return variable
