<SYSTEM_TASK:>
Solve the following problem using Python, implementing the functions described below, one line at a time
<END_TASK>
<USER_TASK:>
Description:
 def get_aws_creds(self):
 """ Returns AWS credentials obtained from the shell environment or given profile :return dict: A dictionary containing credentials. This dict has the structure {"region": "", "key": "", "secret": "", "sessiontoken": ""}. If credentials could not be resolved, this returns None """

        result = {}

        # to pass command line arguments for region & profile to setup boto3 default session
        if boto3.DEFAULT_SESSION:
            session = boto3.DEFAULT_SESSION
        else:
            session = boto3.session.Session()

        profile_name = session.profile_name if session else None
        LOG.debug("Loading AWS credentials from session with profile '%s'", profile_name)

        if not session:
            return result

        # Load the credentials from profile/environment
        creds = session.get_credentials()

        if not creds:
            # If we were unable to load credentials, then just return empty. We will use the default
            return result

        # After loading credentials, region name might be available here.
        if hasattr(session, 'region_name') and session.region_name:
            result["region"] = session.region_name

        # Only add the key, if its value is present
        if hasattr(creds, 'access_key') and creds.access_key:
            result["key"] = creds.access_key

        if hasattr(creds, 'secret_key') and creds.secret_key:
            result["secret"] = creds.secret_key

        if hasattr(creds, 'token') and creds.token:
            result["sessiontoken"] = creds.token

        return result