<SYSTEM_TASK:>
Solve the following problem using Python, implementing the functions described below, one line at a time
<END_TASK>
<USER_TASK:>
Description:
 def format_args_for_target(self, target, target_workdir):
 """Calculate the arguments to pass to the command line for a single target."""


    args = ['--java_out={0}'.format(target_workdir)]

    # Add all params in payload to args

    relative_sources, source_roots = self._compute_sources(target)

    if target.payload.get_field_value('no_options'):
      args.append('--no_options')

    if target.payload.service_writer:
      args.append('--service_writer={}'.format(target.payload.service_writer))
      if target.payload.service_writer_options:
        for opt in target.payload.service_writer_options:
          args.append('--service_writer_opt')
          args.append(opt)

    registry_class = target.payload.registry_class
    if registry_class:
      args.append('--registry_class={0}'.format(registry_class))

    if target.payload.roots:
      args.append('--roots={0}'.format(','.join(target.payload.roots)))

    if target.payload.enum_options:
      args.append('--enum_options={0}'.format(','.join(target.payload.enum_options)))

    for source_root in source_roots:
      args.append('--proto_path={0}'.format(os.path.join(get_buildroot(), source_root)))

    args.extend(relative_sources)
    return args