def replace_string(metadata, field, from_str, to_str):
    """Replace part of a string in given metadata field"""
    new = None
    if from_str in metadata[field]:
        new = metadata[field].replace(from_str, to_str)
    return new