def generate_database_url(dbtype=None, username=None, password=None, host=
    None, table=None, template=None):
    """
    Generate a database url from input parameters, or get a template
        dbtype: the type of database, must be one of "mysql" or "postgresql"
        username: username to connect to the database
        password: password to connect to the database
        host: database host
        table: table in the database
        template: can be one of "mysql" "sqlite3" or "postgresql" If specified, all other parameters are
                  ignored, and a default database URL is produced to work in a Vagrant VM
    
    """
    if not template:
        if not dbtype or not username or not password or not host or not table:
            print(
                'Please provide all inputs: dbtype,username,password,host,table.'
                )
        else:
            return '%s://%s:%s@%s/%s' % (dbtype, username, password, host,
                table)
    elif template == 'mysql':
        return 'mysql://wordfish:wordfish@localhost:3306/wordfish'
    elif template == 'postgresql':
        return 'postgresql://wordfish:wordfish@localhost:5432/wordfish'
