How to check drupal user has a node edit permission or not

$node = node_load(123);
$account = user_load(456);

if (node_access("update", $node, $account) === TRUE) {
  do_something_awesome();
}