def encode_username(df, drop_field=True):
    """
        Username one-hot encoder.
        inputs:
            df: Dataframe which have username column (pandas df series)
            drop_field: a flag if the usename column should be dropped or not after encoding (bool)
        return:
            df: Dataframe which have only username indicator [0/1] (pandas df series)
    """
    df.loc[df.username != 'default', 'username_flag'] = 1
    df.loc[df.username == 'default', 'username_flag'] = 0
    if drop_field:
        df = df.drop(columns='username')
    return df
