'Checks for the existence of an AWS credential file.
If the environment variable AWS_CREDENTIAL_FILE is
set and points to a file, that file will be read and
will be searched credentials.
Note that if credentials have been explicitelypassed
into the class constructor, those values always take
precedence.'

def check_for_credential_file(self):

    if ('AWS_CREDENTIAL_FILE' in os.environ):
        path = os.environ['AWS_CREDENTIAL_FILE']
        path = os.path.expanduser(path)
        path = os.path.expandvars(path)
        if os.path.isfile(path):
            fp = open(path)
            lines = fp.readlines()
            fp.close()
            for line in lines:
                if (line[0] != '#'):
                    if ('=' in line):
                        (name, value) = line.split('=', 1)
                        if (name.strip() == 'AWSAccessKeyId'):
                            if ('aws_access_key_id' not in self.args):
                                value = value.strip()
                                self.args['aws_access_key_id'] = value
                        elif (name.strip() == 'AWSSecretKey'):
                            if ('aws_secret_access_key' not in self.args):
                                value = value.strip()
                                self.args['aws_secret_access_key'] = value
        else:
            print('Warning:    unable    to    read    AWS_CREDENTIAL_FILE')
