code: def _construct_adb_cmd(self, raw_name, args, shell):
          
          args = args or ''
          name = raw_name.replace('_', '-')
          if shell:
              args = utils.cli_cmd_to_string(args)
              # Add quotes around "adb" in case the ADB path contains spaces. This
              # is pretty common on Windows (e.g. Program Files).
              if self.serial:
                  adb_cmd = '"%s" -s "%s" %s %s' % (ADB, self.serial, name, args)
              else:
                  adb_cmd = '"%s" %s %s' % (ADB, name, args)
          else:
              adb_cmd = [ADB]
              if self.serial:
                  adb_cmd.extend(['-s', self.serial])
              adb_cmd.append(name)
              if args:
                  if isinstance(args, basestring):
                      adb_cmd.append(args)
                  else:
                      adb_cmd.extend(args)
          return adb_cmd
docs: Constructs an adb command with arguments for a subprocess call.
  
          Args:
              raw_name: string, the raw unsanitized name of the adb command to
                  format.
              args: string or list of strings, arguments to the adb command.
                  See subprocess.Proc() documentation.
              shell: bool, True to run this command through the system shell,
                  False to invoke it directly. See subprocess.Proc() docs.
  
          Returns:
              The adb command in a format appropriate for subprocess. If shell is
                  True, then this is a string; otherwise, this is a list of
                  strings.