def validate_parameter(self, parameter):
    'Gate parameters should be int, float, or ParameterExpression'
    if isinstance(parameter, ParameterExpression):
        if (len(parameter.parameters) > 0):
            return parameter
        if (not parameter._symbol_expr.is_real):
            raise CircuitError('Bound parameter expression is complex in gate {}'.format(self.name))
        return parameter
    if isinstance(parameter, (int, float)):
        return parameter
    elif isinstance(parameter, (np.integer, np.floating)):
        return parameter.item()
    elif isinstance(parameter, np.ndarray):
        warn(('Gate param type %s is being deprecated as of 0.16.0, and will be removed no earlier than 3 months after that release date. Considering creating your own Gate subclass with the method validate_parameter  to allow this param type.' % type(parameter)), DeprecationWarning, 3)
        return parameter
    else:
        raise CircuitError('Invalid param type {0} for gate {1}.'.format(type(parameter), self.name))
Gate parameters should be int, float, or ParameterExpression
def validate_parameter(self, parameter):
    
    if isinstance(parameter, ParameterExpression):
        if (len(parameter.parameters) > 0):
            return parameter
        if (not parameter._symbol_expr.is_real):
            raise CircuitError('Bound parameter expression is complex in gate {}'.format(self.name))
        return parameter
    if isinstance(parameter, (int, float)):
        return parameter
    elif isinstance(parameter, (np.integer, np.floating)):
        return parameter.item()
    elif isinstance(parameter, np.ndarray):
        warn(('Gate param type %s is being deprecated as of 0.16.0, and will be removed no earlier than 3 months after that release date. Considering creating your own Gate subclass with the method validate_parameter  to allow this param type.' % type(parameter)), DeprecationWarning, 3)
        return parameter
    else:
        raise CircuitError('Invalid param type {0} for gate {1}.'.format(type(parameter), self.name))