code: def build_credentials_block(credentials: ReadOnlyCredentials) -> str:
      """Generate AWS credentials block for Redshift COPY and UNLOAD commands.
  
      See AWS docs for details:
      https://docs.aws.amazon.com/redshift/latest/dg/copy-parameters-authorization.html#copy-credentials
  
      :param credentials: ReadOnlyCredentials object from `botocore`
      """
      if credentials.token:
          log.debug(
              "STS token found in credentials, including it in the command"
          )
          # these credentials are obtained from AWS STS
          # so the token must be included in the CREDENTIALS clause
          credentials_line = (
              f"aws_access_key_id={credentials.access_key};"
              f"aws_secret_access_key={credentials.secret_key};"
              f"token={credentials.token}"
          )
  
      else:
          credentials_line = f"aws_access_key_id={credentials.access_key};aws_secret_access_key={credentials.secret_key}"
  
      return credentials_line
  
imports: from __future__ import annotations
  import logging
  from typing import TYPE_CHECKING
label_desc: Use image node_id 1 for calling a global function with example usage: build_credentials_block(credentials) and returns: credentials_line