def METHOD_NAME(pkgp):
    # maybe version dash
    fdash = pkgp.find("-")
    # invalid ver (ver should be FOO-VER-rREV)
    if fdash < 0:
        return None, None
    # maybe revision dash
    sdash = pkgp.find("-", fdash + 1)
    # invalid ver again
    if sdash < 0:
        return None, None
    # now get rid of any remaining dashes
    while True:
        ndash = pkgp.find("-", sdash + 1)
        if ndash < 0:
            break
        fdash = sdash
        sdash = ndash
    # and return name/ver
    return pkgp[0:fdash], pkgp[fdash + 1 :]