<SYSTEM_TASK:>
Solve the following problem using Python, implementing the functions described below, one line at a time
<END_TASK>
<USER_TASK:>
Description:

def _str(self, name, val):
        '''
        return a string version of name = val that can be printed

        example -- 
            _str('foo', 'bar') # foo = bar

        name -- string -- the variable name that was passed into one of the public methods
        val -- mixed -- the variable at name's value

        return -- string
        '''
        s = ''
        v = Value(val)

        if name:
            logger.debug("{} is type {}".format(name, v.typename))
            try:
                count = len(val)
                s = "{} ({}) = {}".format(name, count, v.string_value())

            except (TypeError, KeyError, AttributeError) as e:
                logger.info(e, exc_info=True)
                s = "{} = {}".format(name, v.string_value())

        else:
            s = v.string_value()

        return s