function users_getvoprefix () {

if [ $# -ne 1 ]; then
    echo "$0: supply a VO as an argument"
    return 1
fi

# Get all pool accounts for the VO and strip off at most 4 trailing numerals
# Sort the result and take the most numerous entry (there should be
# only one anyway)

return=`awk --posix -F: '$6=="" && $5==tolower(virtorg){sub(/[0-9]{1,4}$/, "", $2); print $2}' virtorg=$1 ${USERS_CONF} | sort | uniq -c | sort -n -k 1,1 | tail -1 | awk '{print $2}'`

if [ "$return" ]; then
    echo $return
    return 0
else
    echo "$FUNCNAME: could not find pool account prefix for $1 in ${USERS_CONF}" 1>&2
    return 1
fi

}
