def _get_proc_username(proc):
    '''
    Returns the username of a Process instance.

    It's backward compatible with < 2.0 versions of psutil.
    '''
    try:
        return salt.utils.data.decode(proc.username() if PSUTIL2 else proc.username)
    except (psutil.NoSuchProcess, psutil.AccessDenied, KeyError):
        return None