def METHOD_NAME(x):
    if isinstance(x, dict):
        return x.copy()
    if isinstance(x, Sample):
        x = x.array
    if isinstance(x, Image.Image):
        return x
    if isinstance(x, str):
        return x
    try:
        copy = cast_type(x)
    except AttributeError:
        return bytes(x)
    if copy is None:
        copy = x.copy()
    if isinstance(copy, Polygons):
        copy = copy.numpy()
    return copy