<SYSTEM_TASK:>
Solve the following problem using Python, implementing the functions described below, one line at a time
<END_TASK>
<USER_TASK:>
Description:
 def _lock_fxn(direction, lock_mode, xact):
 """Builds a pg advisory lock function name based on various options. :direction: one of "lock" or "unlock" :lock_mode: a member of the LockMode enum :xact: a boolean, if True the lock will be automatically released at the end of the transaction and cannot be manually released. """

  if direction == "unlock" or lock_mode == LockMode.wait:
    try_mode = ""
  else:
    try_mode = "_try"

  if direction == "lock" and xact:
    xact_mode = "_xact"
  else:
    xact_mode = ""

  return "pg{}_advisory{}_{}".format(try_mode, xact_mode, direction)