docs: def _setup_s3(settings, path, prompt=True):
      """
      Prompt user to set up Amazon S3.
      """
      ret = {'default_s3_buckets': {}, 's3_credentials': settings.get('s3_credentials', {})}
  
      if prompt:
          use = raw_input("\nWould you like to set up Amazon S3? [Y/n] ")
          if use.lower() != "y" and use != "":
              puts("\n- Not configuring Amazon S3.")
              return ret
  
      existing_access_key = settings.get('default_s3_access_key_id', None) or \
                            os.environ.get('AWS_ACCESS_KEY_ID', None)
      existing_secret_key = settings.get('default_s3_secret_access_key', None) or \
                            os.environ.get('AWS_SECRET_ACCESS_KEY', None)
  
      access_key_prompt = "\nPlease enter your default Amazon Access Key ID:"
      if existing_access_key:
          access_key_prompt += ' [%s] ' % existing_access_key
      else:
          access_key_prompt += ' (leave blank to skip) '
      default_aws_access_key_id = raw_input(access_key_prompt)
  
      if default_aws_access_key_id == '' and existing_access_key:
          default_aws_access_key_id = existing_access_key
  
  
      if default_aws_access_key_id:
          secret_key_prompt = "\nPlease enter your default Amazon Secret Access Key:"
          if existing_secret_key:
              secret_key_prompt += ' [%s] ' % existing_secret_key
          else:
              secret_key_prompt += ' (leave blank to skip) '
          default_aws_secret_access_key = raw_input(secret_key_prompt)
  
          if default_aws_secret_access_key == '' and existing_secret_key:
              default_aws_secret_access_key = existing_secret_key
  
          ret.update({
              'default_s3_access_key_id': default_aws_access_key_id,
              'default_s3_secret_access_key': default_aws_secret_access_key,
          })
  
      # If we're all set with AWS creds, we can setup our default
      # staging and production buckets
      if default_aws_access_key_id and default_aws_secret_access_key:
          existing_staging_bucket = None
          existing_production_bucket = None
          if settings.get('default_s3_buckets'):
              existing_staging_bucket = settings['default_s3_buckets'].get('staging', None)
              existing_production_bucket = settings['default_s3_buckets'].get('production', None)
  
          staging_prompt = "\nWhat is your default staging bucket?"
          if existing_staging_bucket:
              staging_prompt += ' [%s] ' % existing_staging_bucket
          else:
              staging_prompt += ' (e.g. apps.beta.myorg.com, leave blank to skip) '
          staging = raw_input(staging_prompt)
  
          if staging == '' and existing_staging_bucket:
              staging = existing_staging_bucket
          if staging != "":
              ret['default_s3_buckets'].update({
                  'staging': staging,
              })
  
          production_prompt = "\nWhat is your default production bucket?"
          if existing_production_bucket:
              production_prompt += ' [%s] ' % existing_production_bucket
          else:
              production_prompt += ' (e.g. apps.myorg.com, leave blank to skip) '
          production = raw_input(production_prompt)
  
          if production == '' and existing_production_bucket:
              production = existing_production_bucket
          if production != "":
              ret['default_s3_buckets'].update({
                  'production': production,
              })
  
  
      more_prompt = "\nWould you like to add additional buckets and credentials? [y/N] "
      while raw_input(more_prompt).lower() == 'y':
          ## Ask for a uri
          additional_s3_bucket = raw_input(
              "\nPlease specify an additional bucket (e.g. "
              "additional.bucket.myorg.com/, leave blank to skip adding bucket) ")
          if additional_s3_bucket == "":
              continue
  
          ## Ask for an access key, if it differs from the default
          additional_access_key_prompt = "\nPlease specify an AWS Access Key ID for this bucket:"
  
          if default_aws_access_key_id:
              additional_access_key_prompt += ' [%s] ' % default_aws_access_key_id
          else:
              additional_access_key_prompt += ' (leave blank to skip adding bucket) '
  
          additional_aws_access_key_id = raw_input(additional_access_key_prompt)
  
          if additional_aws_access_key_id == "" and default_aws_access_key_id:
              additional_aws_access_key_id = default_aws_access_key_id
          elif additional_aws_access_key_id == "":
              continue
  
          # Ask for a secret key, if it differs from default
          additional_secret_key_prompt = "\nPlease specify an AWS Secret Access Key for this bucket:"
  
          if default_aws_secret_access_key:
              additional_secret_key_prompt += ' [%s] ' % default_aws_secret_access_key
          else:
              additional_secret_key_prompt += ' (leave blank to skip adding bucket) '
  
          additional_aws_secret_access_key = raw_input(
              additional_secret_key_prompt)
  
          if additional_aws_secret_access_key == "" and default_aws_secret_access_key:
              additional_aws_secret_access_key = default_aws_secret_access_key
          elif additional_aws_secret_access_key == "":
              continue
  
          ret['s3_credentials'][additional_s3_bucket] = {
              'access_key_id': additional_aws_access_key_id,
              'secret_access_key': additional_aws_secret_access_key,
          }
  
      puts("\n- Done configuring Amazon S3.")
      return ret