def merge_regions_and_departments(regions, departments):
    """Merge regions and departments in one DataFrame.

    The columns in the final DataFrame should be:
    ['code_reg', 'name_reg', 'code_dep', 'name_dep']
    """
    temp1 = regions.rename(columns={"code":"region_code","name":"name_reg","id":"id_reg","slug":"slug_reg"})
    temp2 = departments.rename(columns={"code":"code_dep","name":"name_dep"})
    df = temp1.merge(temp2, on = "region_code" )
    df = df.rename(columns={"region_code":"code_reg"})
    df = df.drop(["id_reg","id","slug","slug_reg"],axis="columns")
    return df