code: def get_ssh_dir(config, username):
      
      sshdir = config.get('ssh_config_dir')
      if not sshdir:
          sshdir = os.path.expanduser('~/.ssh')
          if not os.path.isdir(sshdir):
              pwentry = getpwnam(username)
              sshdir = os.path.join(pwentry.pw_dir, '.ssh')
              if not os.path.isdir(sshdir):
                  sshdir = None
      return sshdir
docs: Get the users ssh dir