def METHOD_NAME(source, root):
  '''
  Prepare source directory based on different source types.
  source -- string with either local directory path, remote http(s) archive or git repository
  root   -- local directory where to store processed source files
  For git repository following format is understood:
    [http[s]://|git://][user@]hostname/repository[#revision[:subdirectory]]
  '''
  dest = os.path.join(root, 'source')
  log.debug('Preparing build source for {0} to {1}'.format(source, dest))
  if _isLocal(source):
    return _prepareLocal(source, dest)
  elif _isTarball(source):
    return _prepareHTTP(source, dest)
  elif _isGit(source):
    return _prepareGit(source, dest, root)
  else:
    raise salt.exceptions.SaltException('Unknown source format "{0}"'.format(source))