def appendDtectArgs( cmd, args=None ):
  """Append OpendTect arguments

  Parameters:
    * cmd (list): List to which the returned elements will be added
    * arg (dict, optional):
      Dictionary with the members 'dtectdata' and 'survey' as 
      single element lists, and/or 'dtectexec' (see odpy.getODSoftwareDir)

  Returns:
    * list: Input list with the added data root and survey directory name if provided

  Examples:
    >>> args = {
      'dtectdata': ['D:\\ODData'],
      'survey': ['F3_Demo']
    }

    >>> appendDtectArgs( list(), args=args )
    ['--dataroot', 'D:\\ODData', '--survey', 'F3_Demo']

  """

  if args == None:
    return cmd
  if 'dtectdata' in args:
    cmd.append( '--dataroot' )
    cmd.append( args['dtectdata'][0] )
  if 'survey' in args:
    cmd.append( '--survey' )
    cmd.append( args['survey'][0] )
  return cmd