def astype(value, types=None):
    """Return argument as one of types if possible."""
    if value[0] in '\'"':
        return value[1:-1]
    if types is None:
        types = int, float, str
    for typ in types:
        try:
            return typ(value)
        except (ValueError, TypeError, UnicodeEncodeError):
            pass
    return value