Return the basename of a SysFS key path

    :param key: the location to resolve within SysFS
    :param full: full path instead of basename

    :return: fullpath or basename of path

    CLI example:
     .. code-block:: bash

        salt '*' sysfs.read class/ttyS0

def target(key, full=True):
    '''
    Return the basename of a SysFS key path

    :param key: the location to resolve within SysFS
    :param full: full path instead of basename

    :return: fullpath or basename of path

    CLI example:
     .. code-block:: bash

        salt '*' sysfs.read class/ttyS0

    '''
    if not key.startswith('/sys'):
        key = os.path.join('/sys', key)
    key = os.path.realpath(key)

    if not os.path.exists(key):
        log.debug('Unkown SysFS key %s', key)
        return False
    elif full:
        return key
    else:
        return os.path.basename(key)