def AuthorizeSshKeys(self, user, ssh_keys):
    """Add ssh_keys to the user's ssh authorized_keys.gce file."""
    (home_dir, uid, gid) = self.GetUserInfo(user)

    ssh_dir = os.path.join(home_dir, '.ssh')

    if not self.os.path.isdir(ssh_dir):
      # Create a user's ssh directory, with u+rwx as the only permissions.
      # There's proper handling and logging of OSError within EnsureDir(),
      # so neither of these calls needs th handle that.
      if not self.EnsureHomeDir(home_dir, uid, gid):
        return False

      if not self.EnsureDir(ssh_dir, uid, gid, 0700):
        return False

    # Not all sshd's support mulitple authorized_keys files.  We have to
    # share one with the user.  We add our entries as follows:
    #  # Added by Google
    #  authorized_key_entry
    authorized_keys_file = os.path.join(ssh_dir, 'authorized_keys')
    try:
      self.WriteAuthorizedSshKeysFile(authorized_keys_file, ssh_keys, uid, gid)
    except __HOLE__ as e:
      logging.warning('Could not update %s due to %s', authorized_keys_file, e)
dataset/ETHPy150Open GoogleCloudPlatform/compute-image-packages/google-daemon/usr/share/google/google_daemon/accounts.py/Accounts.AuthorizeSshKeys