Help to simplify/optimize a function

you can optimize it even more:
def maybe_reshape(k, v) when is_atom(k) and is_binary(v) do