def create_credentials(credentials_file=None,
                       service_email=None,
                       service_key=None,
                       scope='https://www.googleapis.com/auth/androidpublisher'):
    """
    Create Google credentials object.

    If given credentials_file is None, try to retrieve file path from environment 
    or look up file in homefolder.
    """
    credentials = None
    if service_email is None and service_key is None:
        print(credentials_file)
        if credentials_file is None:
            # try load file from env
            key = 'PLAY_DELIVER_CREDENTIALS'
            if key in os.environ:
                credentials_file = os.environ[key]

        if credentials_file is None:
            # try to find the file in home
            path = os.path.expanduser('~/.playdeliver/credentials.json')
            if os.path.exists(path):
                credentials_file = path

        if credentials_file is not None:
            credentials = client.GoogleCredentials.from_stream(
                credentials_file)
            credentials = credentials.create_scoped(scope)
        else:
            sys.exit("no credentials")
    else:
        credentials = client.SignedJwtAssertionCredentials(
            service_email, _load_key(service_key), scope=scope)
    return credentials
Create Google credentials object.

    If given credentials_file is None, try to retrieve file path from environment 
    or look up file in homefolder.