add pydist code
add pydist: user-defined metric