def getNumberFromId(obj_id):
    """Returns the long decimal number (as a string) from the end of a wsadmin object id string.

    For example, returns 1157676511879 from the following id:
    PAP_1(cells/ding6Cell01|coregroupbridge.xml#PeerAccessPoint_1157676511879)

    Returns the original id string if the ID string can not be parsed.
    """
    longnum = obj_id
    if longnum.endswith(')'):
        # Strip off the trailing parenthesis
        len_orig = len(longnum)
        longnum = longnum[:len_orig-1]
        # Find the index of the last underscore.
        ix = longnum.rfind('_')
        if -1 != ix:
            # Extract the number.
            longnum = longnum[ix+1:]
    return longnum